Fix minor bug in writing configuration file.

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

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)"