1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
#! /bin/sh
# preinst script for littex
#
set -e
PACKAGE=littex
# summary of how this script can be called:
# * <new-preinst> `install'
# * <new-preinst> `install' <old-version>
# * <new-preinst> `upgrade' <old-version>
# * <old-preinst> `abort-upgrade' <new-version>
#
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
remove_conffile_prepare () {
# syntax: remove_conffile_prepare filename official_md5sum ...
#
# Check a conffile "filename" against a list of canonical MD5 checksums.
# If the file's current MD5 checksum matches one of the "official_md5sum"
# operands provided, then prepare the conffile for removal from the system.
# We defer actual deletion until the package is configured so that we can
# roll this operation back if package installation fails.
#
# Call this function from a preinst script in the event $1 is "upgrade" or
# "install" and verify $2 to ensure the package is being upgraded from a
# version (or installed over a version removed-but-not-purged) prior to the
# one in which the conffile was obsoleted.
# validate arguments
if [ $# -lt 3 ]; then
echo "remove_conffile_prepare() called with wrong number of" \
"arguments; expected at least 3, got $#"
exit 2
fi
conffile="$1"
newloc="$2"
shift ; shift
# does the conffile even exist?
if [ -e "$conffile" ]; then
# calculate its checksum
current_checksum=$(md5sum < "$conffile" | sed 's/[[:space:]].*//')
# compare it to each supplied checksum
while [ -n "$1" ]; do
if [ "$current_checksum" = "$1" ]; then
# we found a match; move the confffile and stop looking
echo "preparing obsolete conffile $conffile for removal"
mv "$conffile" "$conffile.${PACKAGE}-tmp"
break
fi
shift
done
# if it is still readable we move it was changed, so move it
# to the new location
if [ -e "$conffile" ]; then
echo "moving changed $conffile to new location"
mv "$conffile" "$newloc"
fi
fi
}
case "$1" in
install|upgrade)
if dpkg --compare-versions "$2" le "20060922-1"; then
remove_conffile_prepare /etc/texmf/updmap.d/10littex.cfg \
/etc/texmf/updmap.d/20littex.cfg \
f77aeb095663182fa6e4d47917b3cf1b
remove_conffile_prepare /etc/texmf/language.d/10littex.cnf \
/etc/texmf/language.d/20littex.cnf \
181ef91113d6a428f0059fc51dd81079
fi
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0
|