Imported Debian patch 4.84-8
[hcoop/debian/exim4.git] / debian / exim4-config.preinst
1 #!/bin/sh
2
3 set -e
4
5 if [ -n "$EX4DEBUG" ]; then
6 echo "now debugging $0 $@"
7 set -x
8 fi
9
10 # Remove a no-longer used conffile
11 # Solution and code taken from http://wiki.debian.org/DpkgConffileHandling
12 # and "beautified" (hopefully not broken)
13 rm_conffile() {
14 PKGNAME="$1"
15 CONFFILE="$2"
16
17 if [ -e "$CONFFILE" ]; then
18 md5sum="$(md5sum "$CONFFILE" | sed -e "s/ .*//")"
19 old_md5sum="$(dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e "\' $CONFFILE'{s/ obsolete$//;s/.* //;p;}")"
20 if [ "$md5sum" != "$old_md5sum" ]; then
21 echo "Obsolete conffile $CONFFILE has been modified by you."
22 echo "Saving as $CONFFILE.dpkg-bak ..."
23 mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
24 else
25 echo "Removing obsolete conffile $CONFFILE ..."
26 rm -f "$CONFFILE"
27 fi
28 fi
29 }
30
31 case "$1" in
32 install|upgrade)
33 if dpkg --compare-versions "$2" lt "4.68-1"; then
34 rm_conffile exim4-config "/etc/exim4/conf.d/acl/20_exim4-config_whitelist_local_deny"
35 rm_conffile exim4-config "/etc/exim4/conf.d/router/250_exim4-config_lowuid"
36 fi
37 esac
38
39 #DEBHELPER#