packages.rb 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #
  2. # Cookbook Name:: dovecot
  3. # Recipe:: packages
  4. #
  5. # Copyright 2013, Onddo Labs, Sl.
  6. #
  7. # Licensed under the Apache License, Version 2.0 (the "License");
  8. # you may not use this file except in compliance with the License.
  9. # You may obtain a copy of the License at
  10. #
  11. # http://www.apache.org/licenses/LICENSE-2.0
  12. #
  13. # Unless required by applicable law or agreed to in writing, software
  14. # distributed under the License is distributed on an "AS IS" BASIS,
  15. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. # See the License for the specific language governing permissions and
  17. # limitations under the License.
  18. #
  19. case node['platform']
  20. when 'redhat','centos','scientific','fedora','suse','amazon' then
  21. # core, imap, pop3, lmtp, ldap, sqlite
  22. package 'dovecot' do
  23. [ 'core', 'imap', 'pop3', 'lmtp', 'ldap' ].each do |conf_type|
  24. node['dovecot']['conf_files'][conf_type].each do |conf_file|
  25. notifies :create, "template[#{conf_file}]", :immediately
  26. end
  27. end
  28. end
  29. # sieve
  30. package 'dovecot-pigeonhole' do
  31. only_if do Dovecot::Plugins.required?('sieve', node['dovecot']) end
  32. node['dovecot']['conf_files']['sieve'].each do |conf_file|
  33. notifies :create, "template[#{conf_file}]", :immediately
  34. end
  35. end
  36. when 'debian', 'ubuntu' then
  37. # core
  38. package 'dovecot-core' do
  39. node['dovecot']['conf_files']['core'].each do |conf_file|
  40. notifies :create, "template[#{conf_file}]", :immediately
  41. end
  42. end
  43. package 'dovecot-gssapi'
  44. # imap
  45. package 'dovecot-imapd' do
  46. only_if do Dovecot::Protocols.enabled?('imap', node['dovecot']['protocols']) end
  47. node['dovecot']['conf_files']['imap'].each do |conf_file|
  48. notifies :create, "template[#{conf_file}]", :immediately
  49. end
  50. end
  51. # pop3
  52. package 'dovecot-pop3d' do
  53. only_if do Dovecot::Protocols.enabled?('pop3', node['dovecot']['protocols']) end
  54. node['dovecot']['conf_files']['pop3'].each do |conf_file|
  55. notifies :create, "template[#{conf_file}]", :immediately
  56. end
  57. end
  58. # lmtp
  59. package 'dovecot-lmtpd' do
  60. only_if do Dovecot::Protocols.enabled?('lmtp', node['dovecot']['protocols']) end
  61. node['dovecot']['conf_files']['lmtp'].each do |conf_file|
  62. notifies :create, "template[#{conf_file}]", :immediately
  63. end
  64. end
  65. # sieve
  66. package 'dovecot-sieve' do
  67. only_if do Dovecot::Plugins.required?('sieve', node['dovecot']) end
  68. node['dovecot']['conf_files']['sieve'].each do |conf_file|
  69. notifies :create, "template[#{conf_file}]", :immediately
  70. end
  71. end
  72. package 'dovecot-managesieved' do
  73. only_if do Dovecot::Plugins.required?('sieve', node['dovecot']) end
  74. end
  75. # ldap
  76. package 'dovecot-ldap' do
  77. only_if do node['dovecot']['auth']['ldap'].kind_of?(Array) and node['dovecot']['auth']['ldap'].length > 0 end
  78. node['dovecot']['conf_files']['ldap'].each do |conf_file|
  79. notifies :create, "template[#{conf_file}]", :immediately
  80. end
  81. end
  82. # sqlite
  83. package 'dovecot-sqlite' do
  84. only_if do node['dovecot']['conf']['sql']['driver'] == 'sqlite' end
  85. end
  86. else
  87. log('Unsupported platform, trying to guess dovecot packages') { level :warn }
  88. package 'dovecot'
  89. end
  90. package 'dovecot-mysql' do
  91. only_if do node['dovecot']['conf']['sql']['driver'] == 'mysql' end
  92. end
  93. package 'dovecot-pgsql' do
  94. only_if do node['dovecot']['conf']['sql']['driver'] == 'pgsql' end
  95. end