#!/bin/sh set -e # Debian Postfix preinst # LaMont Jones # Modified to use debconf by Colin Walters # do we have debconf? if [ -f /usr/share/debconf/confmodule ]; then . /usr/share/debconf/confmodule DEBCONF=true else DEBCONF= fi MASTER=/etc/postfix/master.cf (umask 022; mkdir -p /var/spool/postfix) case "$1" in install) rm -f /var/spool/postfix/restart /var/spool/postfix/reload # workaround sendmail not unregistering itself... if [ -e /etc/suid.conf ] && [ -x /usr/sbin/suidunregister ]; then if grep -q sendmail /etc/suid.conf; then /usr/sbin/suidunregister -s postfix /usr/sbin/sendmail fi fi if [ -L /etc/postfix/postfix-script ]; then rm -f /etc/postfix/postfix-script fi ;; upgrade) version=$2 if [ -d /var/spool/postfix ] && [ -f /etc/postfix/main.cf ]; then touch /var/spool/postfix/restart fi export LANG=C # for the comparison of mail version... if [ -L /etc/postfix/postfix-script ]; then rm -f /etc/postfix/postfix-script fi # If user has not modified master/main.proto, move aside so new version # is installed (#991513) cmp -s /usr/share/postfix/main.cf.dist /etc/postfix/main.cf.proto && \ mv /etc/postfix/main.cf.proto /etc/postfix/main.cf.proto.old \ || echo "/etc/postfix/main.cf.proto modified, not updating." cmp -s /usr/share/postfix/master.cf.dist /etc/postfix/master.cf.proto && \ mv /etc/postfix/master.cf.proto /etc/postfix/master.cf.proto.old \ || echo "/etc/postfix/master.cf.proto modified, not updating." ;; abort-upgrade) if [ -f /etc/postfix/main.cf.proto.old ]; then mv /etc/postfix/main.cf.proto.old /etc/postfix/main.cf.proto echo "Restoring old /etc/postfix/main.cf.proto on failed upgrade." fi if [ -f /etc/postfix/master.cf.proto.old ]; then mv /etc/postfix/master.cf.proto.old /etc/postfix/master.cf.proto echo "Restoring old /etc/postfix/master.cf.proto on failed upgrade." fi ;; *) echo "preinst called with unknown argument \`$1'" >&2 exit 1 ;; esac if [ install = "$1" ] || [ upgrade = "$1" ]; then # cleanup after past mistakes. rm -f /usr/sbin/postconf.postfix dpkg-divert --package postfix-tls --remove \ --divert /usr/sbin/postconf.postfix \ /usr/sbin/postconf >/dev/null 2>/dev/null fi #DEBHELPER#