source: trunk/debathena/config/cluster-login-config/debian/debathena-cluster-login-config.preinst @ 25292

Revision 25292, 1.8 KB checked in by jdreed, 13 years ago (diff)
In cluster-login-config: * Correctly punt the conffiles we removed in 1.36
Line 
1#!/bin/sh
2# preinst script for debathena-cluster-login-config
3#
4# see: dh_installdeb(1)
5
6set -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
16rm_conffile() {
17    local PKGNAME="$1"
18    local CONFFILE="$2"
19
20    [ -e "$CONFFILE" ] || return 0
21
22    local md5sum="$(md5sum $CONFFILE | sed -e 's/ .*//')"
23    local old_md5sum="$(dpkg-query -W -f='${Conffiles}' $PKGNAME | \
24            sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")"
25    # ' # <-- emacs is confused about quoting
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        mv -f "$CONFFILE" "$CONFFILE".dpkg-del
33    fi
34}
35
36case "$1" in
37    install|upgrade)
38        if dpkg --compare-versions "$2" lt 1.24~; then
39            rm_conffile debathena-cluster-login-config "/etc/event.d/ttymsg"
40            rm_conffile debathena-cluster-login-config "/etc/init/ttymsg.conf"
41        fi
42
43        if dpkg --compare-versions "$2" lt 1.36.2~; then
44            rm_conffile debathena-cluster-login-config /etc/apt/sources.list.d/debathena-backports.list
45            rm_conffile debathena-cluster-login-config /etc/apt/preferences.d/debathena-libstdcplusplus.pref
46        fi
47
48    ;;
49
50    abort-upgrade)
51    ;;
52
53    *)
54        echo "preinst called with unknown argument \`$1'" >&2
55        exit 1
56    ;;
57esac
58
59# dh_installdeb will replace this with shell code automatically
60# generated by other debhelper scripts.
61
62#DEBHELPER#
63
64exit 0
65
66
Note: See TracBrowser for help on using the repository browser.