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