Debian Codegraph @

debian/fonts-ipafont-nonfree-jisx0208.preinst

raw
1 #!/bin/sh
2 #
3 # stolen from ttf-dzongkha/debian/ttf-dzongkha.preinst :)
4 #
5
6 set -e
7
8 VERSION=00103-13
9 PKG=ttf-ipafont-jisx0208
10 FILE=/etc/defoma/hints/${PKG}.hints
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
48 # cleanup obsolete alternatives from ttf-ipafont-jisx0208
49 update-alternatives --remove ttf-japanese-gothic.ttf /usr/share/fonts/truetype/ipafont-jisx0208/ipag0208_for_legacy_compatibility.ttf
50 update-alternatives --remove ttf-japanese-mincho.ttf /usr/share/fonts/truetype/ipafont-jisx0208/ipam0208_for_legacy_compatibility.ttf
51
52 if dpkg --compare-versions "$2" lt-nl "$VERSION"; then
53 if [ -f $FILE ]; then
54 if `pathfind defoma-font`; then
55 defoma-font purge-all $FILE || true
56 fi
57 fi
58 rm_conffile $PKG $FILE
59 fi
60 esac
61
62 #DEBHELPER#
63
64 exit 0