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

« back to all changes in this revision

Viewing changes to debian/otf-thai-tlwg.preinst

  • Committer: Bazaar Package Importer
  • Author(s): Theppitak Karoonboonyanan
  • Date: 2009-12-04 18:43:46 UTC
  • Revision ID: james.westby@ubuntu.com-20091204184346-abyzocptcczittwg
Tags: 1:0.4.13-4
* debian/{t1,ttf,otf}-thai-tlwg.preinst:
  - Fix wrong usage of 'local' outside function, fixing failure on bash.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#
14
14
# For details see /usr/share/doc/packaging-manual/
15
15
 
16
 
# Remove a no-longer used conffile
 
16
# Remove obsolete conffile
17
17
rm_conffile() {
18
 
    PKGNAME="$1"
19
 
    CONFFILE="$2"
 
18
    local PKGNAME="$1"
 
19
    local CONFFILE="$2"
 
20
    [ -e "$CONFFILE" ] || return 0
20
21
 
21
 
    if [ -e "$CONFFILE" ]; then
22
 
        md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
23
 
        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
 
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"
33
32
    fi
34
33
}
35
34
 
36
35
case "$1" in
37
36
    install|upgrade)
38
 
        if dpkg --compare-versions "$2" le "1:0.4.11-1"; then
39
 
            rm_conffile otf-thai-tlwg "/etc/fonts/conf.avail/65-otf-thai-tlwg.conf"
40
 
        fi
41
 
        if dpkg --compare-versions "$2" le "1:0.4.11-3"; then
 
37
        if dpkg --compare-versions "$2" lt-nl "1:0.4.12-1"; then
42
38
            rm_conffile otf-thai-tlwg "/etc/fonts/conf.avail/90-otf-thai-tlwg-synthetic.conf"
43
39
        fi
 
40
        if dpkg --compare-versions "$2" lt-nl "1:0.4.13-3"; then
 
41
            HINTS_FILE="/etc/defoma/hints/otf-thai-tlwg.hints"
 
42
            if [ -f $HINTS_FILE ] && [ -x /usr/bin/defoma-font ]; then
 
43
                defoma-font purge-all $HINTS_FILE || true
 
44
            fi
 
45
            rm_conffile otf-thai-tlwg $HINTS_FILE
 
46
        fi
44
47
    ;;
45
48
 
46
49
    abort-upgrade)