1 | #!/bin/sh |
---|
2 | # preinst script for debathena-reactivate |
---|
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 | # for details, see http://www.debian.org/doc/debian-policy/ or |
---|
14 | # the debian-policy package |
---|
15 | |
---|
16 | if dpkg-maintscript-helper supports rm_conffile 2> /dev/null; then |
---|
17 | dpkg-maintscript-helper rm_conffile /etc/athena/sudo-error 2.0.39 -- "$@" |
---|
18 | dpkg-maintscript-helper rm_conffile /etc/athena/su-error 2.0.39 -- "$@" |
---|
19 | else |
---|
20 | # From http://wiki.debian.org/DpkgConffileHandling |
---|
21 | rm_conffile() { |
---|
22 | local PKGNAME="$1" |
---|
23 | local CONFFILE="$2" |
---|
24 | |
---|
25 | [ -e "$CONFFILE" ] || return 0 |
---|
26 | |
---|
27 | local md5sum="$(md5sum $CONFFILE | sed -e 's/ .*//')" |
---|
28 | local old_md5sum="$(dpkg-query -W -f='${Conffiles}' $PKGNAME | \ |
---|
29 | sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")" |
---|
30 | if [ "$md5sum" != "$old_md5sum" ]; then |
---|
31 | echo "Obsolete conffile $CONFFILE has been modified by you." |
---|
32 | echo "Saving as $CONFFILE.dpkg-bak ..." |
---|
33 | mv -f "$CONFFILE" "$CONFFILE".dpkg-bak |
---|
34 | else |
---|
35 | echo "Removing obsolete conffile $CONFFILE ..." |
---|
36 | mv -f "$CONFFILE" "$CONFFILE".dpkg-del |
---|
37 | fi |
---|
38 | } |
---|
39 | case "$1" in |
---|
40 | install|upgrade) |
---|
41 | if dpkg --compare-versions "$2" le-nl 2.0.39; then |
---|
42 | rm_conffile debathena-reactivate "/etc/athena/sudo-error" |
---|
43 | rm_conffile debathena-reactivate "/etc/athena/su-error" |
---|
44 | fi |
---|
45 | esac |
---|
46 | fi |
---|
47 | |
---|
48 | # dh_installdeb will replace this with shell code automatically |
---|
49 | # generated by other debhelper scripts. |
---|
50 | |
---|
51 | #DEBHELPER# |
---|
52 | |
---|
53 | exit 0 |
---|