X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=amavisd-cn.git;a=blobdiff_plain;f=src%2Fpostfix.sh;h=c89c30ef3742ed6f1d27dd08500b7f665866b674;hp=e851632f44d400f8ba946915352d929218657005;hb=9881eb03821c641460350eee4ed7aa0350e5c6ca;hpb=caea717ad3441e9f4da8a4112a685ec28066fe4f diff --git a/src/postfix.sh b/src/postfix.sh index e851632..c89c30e 100644 --- a/src/postfix.sh +++ b/src/postfix.sh @@ -1,77 +1,14 @@ update_postfix() { # set up master.cf if [ -f /etc/postfix/master.cf ] && \ - ! grep -q smtp-amavis /etc/postfix/master.cf; then - cp-update $PKG /etc/postfix/master.cf <<-EOF - smtp-amavis unix - - n - 2 smtp - -o smtp_data_done_timeout=1200 - -o disable_dns_lookups=yes - -o smtp_line_length_limit=0 - -o notify_classes=protocol,resource,software - -o max_use=10 - - 127.0.0.1:10025 inet n - n - - smtpd - -o content_filter= - -o local_recipient_maps= - -o smtpd_helo_restrictions= - -o smtpd_client_restrictions= - -o smtpd_sender_restrictions= - -o smtpd_recipient_restrictions=permit_mynetworks,reject - -o mynetworks=127.0.0.0/8 - -o strict_rfc821_envelopes=yes - EOF + \( ! grep -q smtp-amavis /etc/postfix/master.cf || \ + dpkg --compare-versions "$2" lt $MASTTMPLVERSION \); then + noisy_backup /etc/postfix/master.cf + cp-update $PKG /etc/postfix/master.cf < $MASTTMPL fi # 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}." - fi - restart_daemon=1 - changed_config=1 - fi + restart_mta=1 }