source: pkg/boss/main/network-manager-pptp/trunk/debian/network-manager-pptp.preinst @ 4826

Revision 4826, 1.3 KB checked in by alanbach-guest, 6 years ago (diff)
  • Sync'd with Debian 0.7.0-1
Line 
1#!/bin/sh
2
3set -e
4
5# This script can be called in the following ways:
6#
7# Before the package is installed:
8#       <new-preinst> install
9#
10# Before removed package is upgraded:
11#       <new-preinst> install <old-version>
12#
13# Before the package is upgraded:
14#       <new-preinst> upgrade <old-version>
15#
16#
17# If postrm fails during upgrade or fails on failed upgrade:
18#       <old-preinst> abort-upgrade <new-version>
19
20
21# remove a no-longer used conffile
22rm_conffile()
23{
24    PKGNAME="$1"
25    CONFFILE="$2"
26
27    if [ -e "$CONFFILE" ]; then
28        md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
29        old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | 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            rm -f "$CONFFILE"
37        fi
38    fi
39}
40
41
42case "$1" in
43    install|upgrade)
44        if dpkg --compare-versions "$2" lt "0.7.0-1"; then
45            rm_conffile network-manager-pptp /etc/NetworkManager/VPN/nm-ppp-starter.name
46            rm_conffile network-manager-pptp /etc/dbus-1/system.d/nm-ppp-starter.conf
47        fi
48        ;;
49
50    abort-upgrade)
51        ;;
52
53    *)
54        echo "$0 called with unknown argument \`$1'" 1>&2
55        exit 1
56        ;;
57esac
58
59#DEBHELPER#
60
61exit 0
Note: See TracBrowser for help on using the repository browser.