Debian Codegraph @

debian/asterisk-config.preinst

raw
1 #! /bin/sh
2 # preinst script
3 #
4 # see: dh_installdeb(1)
5
6 set -e
7
8 # summary of how this script can be called:
9 # * <new-preinst> `install'
10 # * <new-preinst> `install' <old-version>
11 # * <new-preinst> `upgrade' <old-version>
12 # * <old-preinst> `abort-upgrade' <new-version>
13 #
14 # for details, see http://www.debian.org/doc/debian-policy/ or
15 # the debian-policy package
16
17
18 # Remove a no-longer used conffile
19 rm_conffile() {
20 PKGNAME="$1"
21 CONFFILE="$2"
22
23 if [ -e "$CONFFILE" ]; then
24 md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
25 old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
26 if [ "$md5sum" != "$old_md5sum" ]; then
27 echo "Obsolete conffile $CONFFILE has been modified by you."
28 echo "Saving as $CONFFILE.dpkg-bak ..."
29 mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
30 else
31 echo "Removing obsolete conffile $CONFFILE ..."
32 rm -f "$CONFFILE"
33 fi
34 fi
35 }
36
37 case "$1" in
38 install|upgrade)
39 # chan_modem was removed on 1.4+
40 if dpkg --compare-versions "$2" lt "1:1.4.0-1~"; then
41 rm_conffile asterisk-config "/etc/asterisk/modem.conf"
42 fi
43 ;;
44
45 abort-upgrade)
46 ;;
47
48 *)
49 echo "preinst called with unknown argument \`$1'" >&2
50 exit 1
51 ;;
52 esac
53
54 # dh_installdeb will replace this with shell code automatically
55 # generated by other debhelper scripts.
56
57 #DEBHELPER#
58
59 exit 0