~ldgoodridge95/ubuntu/vivid/upstart/rm-libjson0-dev

« back to all changes in this revision

Viewing changes to debian/upstart.preinst

Tags: upstream-1.7
ImportĀ upstreamĀ versionĀ 1.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh -e
2
 
# This script can be called in the following ways:
3
 
#
4
 
# Before the package is installed:
5
 
#       <new-preinst> install
6
 
#
7
 
# Before removed package is upgraded:
8
 
#       <new-preinst> install <old-version>
9
 
#
10
 
# Before the package is upgraded:
11
 
#       <new-preinst> upgrade <old-version>
12
 
#
13
 
#
14
 
# If postrm fails during upgrade or fails on failed upgrade:
15
 
#       <old-preinst> abort-upgrade <new-version>
16
 
 
17
 
 
18
 
# Prepare to remove a no-longer used conffile
19
 
prep_rm_conffile()
20
 
{
21
 
    CONFFILE="$1"
22
 
 
23
 
    if [ -e "$CONFFILE" ]; then
24
 
        md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
25
 
        old_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $CONFFILE '{s/ obsolete$//;s/.* //;p}}\" /var/lib/dpkg/status`"
26
 
        if [ "$md5sum" != "$old_md5sum" ]; then
27
 
            echo "Obsolete conffile $CONFFILE has been modified by you, renaming to .dpkg-bak"
28
 
            mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
29
 
        else
30
 
            mv -f "$CONFFILE" "$CONFFILE".dpkg-obsolete
31
 
        fi
32
 
    fi
33
 
}
34
 
 
35
 
 
36
 
case "$1" in
37
 
    install|upgrade)
38
 
        # Upgrade from karmic development version
39
 
        if dpkg --compare-versions "$2" lt-nl 0.6.3-7; then
40
 
            prep_rm_conffile /etc/init/dbus-reconnect.conf
41
 
        fi
42
 
        ;;
43
 
 
44
 
    abort-upgrade)
45
 
        ;;
46
 
 
47
 
    *)
48
 
        echo "$0 called with unknown argument \`$1'" 1>&2
49
 
        exit 1
50
 
        ;;
51
 
esac
52
 
 
53
 
#DEBHELPER#
54
 
exit 0