~ubuntu-branches/debian/sid/thaifonts-scalable/sid

7 by Theppitak Karoonboonyanan
* debian/{t1,ttf,otf}-thai-tlwg.preinst:
1
#! /bin/sh
2
# preinst script for t1-thai-tlwg
3
#
4
# see: dh_installdeb(1)
5
6
set -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
# For details see /usr/share/doc/packaging-manual/
15
16
# Remove obsolete conffile
17
rm_conffile() {
18
    local PKGNAME="$1"
19
    local CONFFILE="$2"
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
    if [ "$md5sum" != "$old_md5sum" ]; then
26
        echo "Obsolete conffile $CONFFILE has been modified by you."
27
        echo "Saving as $CONFFILE.dpkg-bak ..."
28
        mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
29
    else
30
        echo "Removing obsolete conffile $CONFFILE ..."
31
        rm -f "$CONFFILE"
32
    fi
33
}
34
35
case "$1" in
36
    install|upgrade)
37
        if dpkg --compare-versions "$2" lt-nl "1:0.4.13-3"; then
38
            HINTS_FILE="/etc/defoma/hints/t1-thai-tlwg.hints"
39
            if [ -f $HINTS_FILE ] && [ -x /usr/bin/defoma-font ]; then
40
                defoma-font purge-all $HINTS_FILE || true
41
            fi
42
	    rm_conffile t1-thai-tlwg $HINTS_FILE
43
	fi
44
    ;;
45
46
    abort-upgrade)
47
    ;;
48
49
    *)
50
        echo "preinst called with unknown argument \`$1'" >&2
51
        exit 0
52
    ;;
53
esac
54
55
# dh_installdeb will replace this with shell code automatically
56
# generated by other debhelper scripts.
57
58
#DEBHELPER#
59
60
exit 0
61
62