Debian Codegraph @

debian/fonts-mikachan.preinst

raw
1 #!/bin/sh
2
3 set -e
4
5 PKG="ttf-mikachan"
6 FILES="/etc/defoma/hints/ttf-mikachan-P.hints \
7 /etc/defoma/hints/ttf-mikachan-PB.hints \
8 /etc/defoma/hints/ttf-mikachan-PS.hints \
9 /etc/defoma/hints/ttf-mikachan.hints"
10 VERSION="9.1-2"
11
12 # Remove a no-longer used conffile
13 rm_conffile() {
14 local PKGNAME="$1"
15 local CONFFILE="$2"
16 [ -e "$CONFFILE" ] || return 0
17
18 local md5sum="$(md5sum $CONFFILE | sed -e 's/ .*//')"
19 local old_md5sum="$(dpkg-query -W -f='${Conffiles}' $PKGNAME | \
20 sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")"
21 if [ "$md5sum" != "$old_md5sum" ]; then
22 echo "Obsolete conffile $CONFFILE has been modified by you."
23 echo "Saving as $CONFFILE.dpkg-bak ..."
24 mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
25 else
26 echo "Removing obsolete conffile $CONFFILE ..."
27 rm -f "$CONFFILE"
28 fi
29 }
30
31 pathfind() {
32 OLDIFS="$IFS"
33 IFS=:
34 for p in $PATH; do
35 if [ -x "$p/$*" ]; then
36 IFS="$OLDIFS"
37 return 0
38 fi
39 done
40 IFS="$OLDIFS"
41 return 1
42 }
43
44
45 case "$1" in
46 install|upgrade)
47 if dpkg --compare-versions "$2" lt-nl "$VERSION"; then
48 for defoma_file in $FILES
49 do
50 if [ -f $defoma_file ]; then
51 if [ -x `pathfind defoma-font` ]; then
52 defoma-font purge-all -vt $defoma_file || true
53 fi
54 fi
55 echo "defoma_file is $defoma_file"
56 rm_conffile $PKG $defoma_file
57 done
58
59 fi
60 esac
61
62 #DEBHELPER#