~siretart/cryptsetup/debian

« back to all changes in this revision

Viewing changes to debian/preinst

  • Committer: Reinhard Tartler
  • Date: 2008-08-06 13:16:09 UTC
  • Revision ID: siretart@tauware.de-20080806131609-ynuo5fib2ndpkmg5
import cryptsetup_1.0.6-5.dsc

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
        fi
13
13
}
14
14
 
 
15
# Remove a no-longer used conffile
 
16
rm_conffile() {
 
17
        PKGNAME="$1"
 
18
        CONFFILE="$2"
 
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-bak ..."
 
25
                        mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
 
26
                else
 
27
                        echo "Removing obsolete conffile $CONFFILE ..."
 
28
                        rm -f "$CONFFILE"
 
29
                fi
 
30
        fi
 
31
}
 
32
 
 
33
LASTVERSION="2:1.0.6-5"
15
34
case "$1" in
16
 
  install)
17
 
    create_etc_keys
18
 
    create_crypttab
19
 
  ;;
20
 
        
21
 
  upgrade|abort-upgrade)
22
 
  ;;
23
 
        
24
 
  *)
25
 
    echo "preinst called with unknown argument '$1'" >&2
26
 
    exit 1
27
 
  ;;
 
35
        install)
 
36
                create_etc_keys
 
37
                create_crypttab
 
38
                if dpkg --compare-versions "$2" le "$LASTVERSION"; then
 
39
                        rm_conffile cryptsetup "/etc/udev/rules.d/z60_cryptsetup.rules"
 
40
                fi
 
41
        ;;
 
42
 
 
43
        upgrade)
 
44
                if dpkg --compare-versions "$2" le "$LASTVERSION"; then
 
45
                        rm_conffile cryptsetup "/etc/udev/rules.d/z60_cryptsetup.rules"
 
46
                fi
 
47
        ;;
 
48
 
 
49
        abort-upgrade)
 
50
        ;;
 
51
 
 
52
        *)
 
53
                echo "preinst called with unknown argument '$1'" >&2
 
54
                exit 1
 
55
        ;;
28
56
esac
29
57
 
30
58
#DEBHELPER#