- # main.cf
- postconf -e content_filter="smtp-amavis:[127.0.0.1]:10024"
-}
-
-conf_postfixize() {
- local tmp
- tmp=`basename $ACONF.dpkg-tmp.$$`
- noisy_backup $ACONF
- # detect non-postfix config
- # XXX add $inet_socket_port & $inet_socket_bind
- if egrep -q '^[[:blank:]]*\$notify_method = .*argv=/usr/sbin/sendmail -Ac.*-odd' $ACONF || \
- ! ( egrep -q '^\$forward_method = '\''smtp:127.0.0.1:10025'\'';[[:blank:]]*(#|$)' $ACONF && \
- egrep -q '^\$notify_method = \$forward_method;[[:blank:]]*(#|$)' $ACONF && \
- egrep -q '^\$inet_socket_port.*10024' $ACONF && \
- egrep -q '^\$inet_socket_bind' $ACONF ); then
- if catpatch $ACONF | patch -sfp0 --dry-run >&- 2>&-; then
- oldpwd=`pwd`
- cd `dirname $ACONF`
- cp -p $ACONF $tmp
- catpatch $tmp | patch -fp0
- cp_mv $tmp $ACONF
- cd $oldpwd
- cp_echo -mailonly "CN: $ACONF patched for postfix."
- # then try to update exact options without disturbing anything else
- elif commented_in_paragraph '^[[:blank:]]*#.*POSTFIX' \
- '^$forward_method = '\''smtp:127.0.0.1:10025'\'';[[:blank:]]*(#|$)' \
- '^\$notify_method = \$forward_method;[[:blank:]]*(#|$)' \
- -f $ACONF &&
- uncommented_in_paragraph '^[[:blank:]]*#.*MILTER' \
- '$forward_method = undef;[[:blank:]]*(#|$)' \
- '$notify_method = .*argv=/usr/sbin/sendmail -Ac.*-odd' \
- -f $ACONF; then
- cp $ACONF $tmp
- uncomment_in_paragraph '^[[:blank:]]*#.*POSTFIX' \
- '^$forward_method = '\''smtp:127.0.0.1:10025'\'';[[:blank:]]*(#|$)' \
- '^\$notify_method = \$forward_method;[[:blank:]]*(#|$)' \
- -f $tmp
- comment_in_paragraph '^[[:blank:]]*#.*MILTER' \
- '$forward_method = undef;[[:blank:]]*(#|$)' \
- '$notify_method = .*argv=/usr/sbin/sendmail -Ac.*-odd' \
- -f $tmp
- cp_mv $tmp $ACONF
- cp_echo "CN: $ACONF updated for ${mta}."
- # or just use the template
- else
- conf_from_template
- cp_echo "CN: Config generated from ${ACONFTMPL}."