Fix minor bug in writing configuration file.

This commit is contained in:
Christoph 2017-10-30 03:55:15 +01:00
parent 1e3bcd35ef
commit f8084d731b
2 changed files with 19 additions and 4 deletions

View File

@ -161,8 +161,12 @@ APACHE_SERVER_KEY=""
# - - you'll need at least dovecot 2.1 for salted passwords ('doveadm pw' 2.0.x doesn't support the '-t' option)
# - - dovecot 2.0.0 - 2.0.7 is not supported
# -
ENCRYPTION_METHOD="cleartext"
#ENCRYPTION_METHOD="dovecot:CRAM-MD5"
# - Example:
# -
# - ENCRYPTION_METHOD="cleartext"
# - ENCRYPTION_METHOD="dovecot:CRAM-MD5"
# -
ENCRYPTION_METHOD=""
# - If you use the dovecot encryption method: where is the dovecotpw binary located?
# -

View File

@ -1787,8 +1787,19 @@ perl -i -n -p -e "s#^(\s*\\\$CONF\['admin_email'\]\s*=.*)#//!\1\n\\\$CONF['admin
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['encrypt'\]\s*=.*)#//!\1\n\\\$CONF['encrypt'] = '$ENCRYPTION_METHOD';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
perl -i -n -p -e "s#^(\s*\\\$CONF\['dovecotpw'\]\s*=.*)#//!\1\n\\\$CONF['dovecotpw'] = '$DOVEADM_PW';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
if grep -q -E "^\\\$CONF\['dovecotpw'\]\s*=.*" "$pfa_conf_file" 2> /dev/null ; then
perl -i -n -p -e "s#^(\\\$CONF\['dovecotpw'\]\s*=.*)#//!\1\n\\\$CONF['dovecotpw'] = '$DOVEADM_PW';#" \
$pfa_conf_file >> $log_file 2>&1 || _failed=true
else
cat <<EOF >> $pfa_conf_file
// If you use the dovecot encryption method: where is the dovecotpw binary located?
// for dovecot 1.x
// \$CONF['dovecotpw'] = "/usr/sbin/dovecotpw";
// for dovecot 2.x (dovecot 2.0.0 - 2.0.7 is not supported!)
\$CONF['dovecotpw'] = "$DOVEADM_PW" ;
EOF
fi
if $_failed ; then
echo_failed
error "$(cat $log_file)"