izmjene za stretch
[amavisd-cn.git] / debian / prerm
1 #!/bin/sh
2 # prerm script for amavisd-cn
3 #
4 # see: dh_installdeb(1)
5
6 set -e
7
8 # summary of how this script can be called:
9 #        * <prerm> `remove'
10 #        * <old-prerm> `upgrade' <new-version>
11 #        * <new-prerm> `failed-upgrade' <old-version>
12 #        * <conflictor's-prerm> `remove' `in-favour' <package>
13 #        <new-version>
14 #        * <deconfigured's-prerm> `deconfigure' `in-favour'
15 #          <package-being-installed> <version> `removing'
16 #          <conflicting-package> <version>
17 # for details, see http://www.debian.org/doc/debian-policy/ or
18 # the debian-policy package
19
20 [ "$DEBIAN_SCRIPT_DEBUG" ] && set -x
21
22 . /usr/share/carnet-tools/functions.sh
23
24 PKG=amavisd-cn
25 ALIASES=/etc/aliases
26 main_cf=/etc/postfix/main.cf
27 master_cf=/etc/postfix/master.cf
28
29 del_postconf() {
30   egrep -v "^$1[[:blank:]]*=[[:blank:]]*" $main_cf > $main_cf.dpkg-tmp.$$
31   cp_mv $main_cf.dpkg-tmp.$$ $main_cf
32 }
33
34 if [ "$1" = remove ]; then
35   if grep -q $PKG $master_cf; then
36     cp-update -r $PKG $master_cf >&-
37     del_postconf content_filter
38     echo "Removed postfix configuration for ${PKG}."
39     service postfix restart
40   fi
41   cp-update -r $PKG $ALIASES >&-
42   newaliases
43 fi
44
45 exit 0
46
47 # dh_installdeb will replace this with shell code automatically
48 # generated by other debhelper scripts.
49
50 #DEBHELPER#