--- ifup-post.orig Wed Mar 21 12:54:36 2001 +++ ifup-post Fri Apr 20 01:35:29 2001 @@ -32,7 +32,8 @@ [ "$?" = 0 ] && set_hostname $HOSTNAME fi -if [ "$PEERDNS" != no -o -n "$RESOLV_MODS" -a "$RESOLV_MODS" != no ]; then +if [ -n "$PEERDNS" -a "$PEERDNS" != no -o \ + -n "$RESOLV_MODS" -a "$RESOLV_MODS" != no ]; then [ -n "$MS_DNS1" ] && DNS1=$MS_DNS1 [ -n "$MS_DNS2" ] && DNS2=$MS_DNS2 if [ -n "$DNS1" ] && ! grep -qs "^nameserver $DNS1" /etc/resolv.conf && @@ -93,7 +94,22 @@ # Notify programs that have requested notification do_netreport -IFDOWN_LOCAL=/sbin/ifup-local +POSTFIX=/usr/sbin/postfix +if [ -n "$SMTP_RELAYHOST" -a -x "$POSTFIX" ] && tr=`mktemp /tmp/postfix.XXXXXX` +then + grep -v ^relayhost /etc/postfix/main.cf >$tr + echo "relayhost = $SMTP_RELAYHOST" >>$tr + + # backup main.cf + cp -af /etc/postfix/main.cf /etc/postfix/main.cf.save + + cat $tr > /etc/postfix/main.cf + rm -f $tr + + "$POSTFIX" reload +fi + +IFUP_LOCAL=/sbin/ifup-local if [ -x "$IFUP_LOCAL" ]; then "$IFUP_LOCAL" "$DEVICE" fi