Added support for Dovecot 2.0, which renames many configuration directives and splits up the config using include files.
---- Changes since 1.550 ----
The Edit Config Files page can now be used to edit any of the Dovecot configuration files, for the case where there are many included configs.
+---- Changes since 1.560 ----
+Fixed support for CentOS 6 and related distributions, which move the Dovecot config to /etc/dovecot/dovecot.conf.
dovecot=/usr/sbin/dovecot
-dovecot_config=/etc/dovecot.conf
+dovecot_config=/etc/dovecot/dovecot.conf /etc/dovecot.conf
init_script=dovecot
pid_file=/var/run/dovecot/master.pid
@mail_envs = ( undef, "maildir:~/Maildir", "mbox:~/mail/:INBOX=/var/mail/%u",
"maildir:~/Maildir:mbox:~/mail/" );
+# get_config_file()
+# Returns the full path to the first valid config file
+sub get_config_file
+{
+foreach my $f (split(/\s+/, $config{'dovecot_config'})) {
+ return $f if (-r $f);
+ }
+return undef;
+}
+
# get_config()
# Returns a list of dovecot config entries
sub get_config
{
if (!scalar(@get_config_cache)) {
- @get_config_cache = &read_config_file($config{'dovecot_config'});
+ @get_config_cache = &read_config_file(&get_config_file());
}
return \@get_config_cache;
}
}
else {
# Need to put at end of main config
- local $lref = &read_file_lines($config{'dovecot_config'});
+ local $lref = &read_file_lines(&get_config_file());
push(@$lref, $newline);
push(@$conf, { 'name' => $name,
'value' => $value,
require './dovecot-lib.pl';
&ui_print_header(undef, $text{'manual_title'}, "");
&ReadParse();
-$file = $in{'file'} || $config{'dovecot_config'};
+$file = $in{'file'} || &get_config_file();
$conf = &get_config();
@files = &unique(map { $_->{'file'} } @$conf);
&indexof($file, @files) >= 0 || &error($text{'manual_efile'});
}
# Check for config file
-if (!-r $config{'dovecot_config'}) {
+if (!&get_config_file()) {
print &ui_config_link('index_econf',
[ "<tt>$config{'dovecot_config'}</tt>", undef ]),"<p>\n";
&ui_print_footer("/", $text{'index'});
sub is_installed
{
return 0 if (!&has_command($config{'dovecot'}) ||
- !-r $config{'dovecot_config'});
+ !&get_config_file());
return $_[0] ? 2 : 1;
}