source: trunk/debathena/third/schroot/debian/schroot.preinst @ 24167

Revision 24167, 1.7 KB checked in by broder, 15 years ago (diff)
Import schroot upstream into subversion.
RevLine 
[24167]1#! /bin/sh
2# preinst script for schroot
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
14# Remove a no-longer used conffile
15rm_conffile() {
16    PKGNAME="$1"
17    CONFFILE="$2"
18
19    if [ -e "$CONFFILE" ]; then
20        md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
21        old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
22        if [ "$md5sum" != "$old_md5sum" ]; then
23            echo "Obsolete conffile $CONFFILE has been modified by you."
24            echo "Saving as $CONFFILE.dpkg-old ..."
25            mv -f "$CONFFILE" "$CONFFILE".dpkg-old
26        else
27            echo "Removing obsolete conffile $CONFFILE ..."
28            rm -f "$CONFFILE"
29        fi
30    fi
31}
32
33# Prepare to move a conffile without triggering a dpkg question
34prep_mv_conffile() {
35    PACKAGE="$1"
36    CONFFILE="$2"
37
38    if [ -e "$CONFFILE" ]; then
39        md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
40        old_md5sum="`dpkg-query -W -f='${Conffiles}' $PACKAGE | sed -n -e \"\\\\' $CONFFILE'{s/.* //;p}\"`"
41        if [ "$md5sum" = "$old_md5sum" ]; then
42            rm -f "$CONFFILE"
43        fi
44    fi
45}
46
47case "$1" in
48install|upgrade)
49    if dpkg --compare-versions "$2" le "1.1.6-1"; then
50         rm_conffile "schroot" "/etc/schroot/setup.d/20network"
51         rm_conffile "schroot" "/etc/schroot/setup.d/30passwd"
52    fi
53esac
54
55# dh_installdeb will replace this with shell code automatically
56# generated by other debhelper scripts.
57
58#DEBHELPER#
59
60exit 0
Note: See TracBrowser for help on using the repository browser.