From f8084d731bd56a87f57061d73e7b58ef73624318 Mon Sep 17 00:00:00 2001 From: Christoph Date: Mon, 30 Oct 2017 03:55:15 +0100 Subject: [PATCH] Fix minor bug in writing configuration file. --- conf/install_postfixadmin.conf.sample | 8 ++++++-- install_postfixadmin.sh | 15 +++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/conf/install_postfixadmin.conf.sample b/conf/install_postfixadmin.conf.sample index 80afd3b..dae6b64 100644 --- a/conf/install_postfixadmin.conf.sample +++ b/conf/install_postfixadmin.conf.sample @@ -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? # - diff --git a/install_postfixadmin.sh b/install_postfixadmin.sh index c59626f..35e8693 100755 --- a/install_postfixadmin.sh +++ b/install_postfixadmin.sh @@ -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 <> $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)"