mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 06:03:28 +00:00
Handle different dovecot config locations on CentOS 6
This commit is contained in:
@@ -21,3 +21,5 @@ Added fields to the SSL page for an optional CA certificate file and private key
|
||||
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.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
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
|
||||
|
||||
@@ -9,12 +9,22 @@ use WebminCore;
|
||||
@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;
|
||||
}
|
||||
@@ -201,7 +211,7 @@ elsif (!$dir && defined($value)) {
|
||||
}
|
||||
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,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
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'});
|
||||
|
||||
@@ -24,7 +24,7 @@ if (!&has_command($config{'dovecot'})) {
|
||||
}
|
||||
|
||||
# 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'});
|
||||
|
||||
@@ -9,7 +9,7 @@ do 'dovecot-lib.pl';
|
||||
sub is_installed
|
||||
{
|
||||
return 0 if (!&has_command($config{'dovecot'}) ||
|
||||
!-r $config{'dovecot_config'});
|
||||
!&get_config_file());
|
||||
return $_[0] ? 2 : 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user