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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
|
#!/bin/bash
# postinst script for dblatex
#
# see: dh_installdeb(1)
set -e
# Tries to remove files below /etc/dblatex/ that aren't any longer considered as
# conffiles, but have been moved below /usr/.
# Removing will only take place if all former conffiles are known to be
# unmodified.
# Input parameter: previousVersion: dblatex version that has been installed
# before this upgrade
function cleanupFormerConfFiles
{
previousVersion=$1
md5File=`tempfile` # Will be filled with conffiles' original fingerprints.
# Common part of conffiles' fingerprints
echo '
d86f4f5e61545a50e995a1afa4d59d5a /etc/dblatex/contrib/db2latex/graphics/caution.eps
483d50b1ed1b738875c3105afedc429e /etc/dblatex/contrib/db2latex/graphics/caution.pdf
d86f4f5e61545a50e995a1afa4d59d5a /etc/dblatex/contrib/db2latex/graphics/important.eps
483d50b1ed1b738875c3105afedc429e /etc/dblatex/contrib/db2latex/graphics/important.pdf
4be6d6bfb336822cba7a67d33198386b /etc/dblatex/contrib/db2latex/graphics/note.eps
6258d6fff717d454c9cc86eab60104de /etc/dblatex/contrib/db2latex/graphics/note.pdf
1530e09fee9164ab7d74275ddee28e4e /etc/dblatex/contrib/db2latex/graphics/tip.eps
3ff749c6a8fd73e60be763d0ac964afe /etc/dblatex/contrib/db2latex/graphics/tip.pdf
d86f4f5e61545a50e995a1afa4d59d5a /etc/dblatex/contrib/db2latex/graphics/warning.eps
483d50b1ed1b738875c3105afedc429e /etc/dblatex/contrib/db2latex/graphics/warning.pdf
75e329ead310665a1120d732915aad67 /etc/dblatex/contrib/db2latex/param.xsl
eb6496905b5fd2ff06c70c5118225cd6 /etc/dblatex/contrib/example/dbsimple.sty
671d7f3ffd82eec65f66dc19ba1b8c96 /etc/dblatex/specs/native.specs
8ad7f76bd4dc662ab947e5f23ea0c246 /etc/dblatex/specs/simple.specs' > $md5File
# version specific part of conffiles' fingerprints
case "$previousVersion" in
0.1.8-1|0.1.8-2)
echo '
840182887de6a6d0808e7bbf0a12ad43 /etc/dblatex/contrib/db2latex/db2latex.sty
d01125a164a0b98870de31cd13ec881b /etc/dblatex/specs/db2latex.specs' >> $md5File
;;
0.1.9-1|0.1.9-2|0.1.9-3|0.1.10-1)
echo '
b3bee6e88493ffa7fe99a1a8a7f89a24 /etc/dblatex/contrib/db2latex/db2latex.sty
d01125a164a0b98870de31cd13ec881b /etc/dblatex/specs/db2latex.specs' >> $md5File
;;
0.2~pre-1)
echo '
0f44c2fdde9fdab3fd1063539a4d35d4 /etc/dblatex/contrib/db2latex/db2latex.sty
aeeda6353bd2493d9ebe3aa9f1a811ed /etc/dblatex/specs/db2latex.specs' >> $md5File
;;
*) # Version which doesn't have to be cleaned up
rm --force $md5File
return
;;
esac
if ! md5sum --check --status $md5File 2>/dev/null
then
# At least one conffile has been changed,
# thus they must not be deleted automatically.
echo "Please consider removing the former conffiles below /etc/dblatex/ manually."
echo "For further information consult README.Debian."
rm --force $md5File
return
fi
while read dummy confFile # Remove all conffiles.
do
rm --force $confFile
done <$md5File
# Clean up all empty directories in directory tree /usr/dblatex/.
cd /etc
rmdir --parents --ignore-fail-on-non-empty dblatex/contrib/db2latex/graphics
rmdir --parents --ignore-fail-on-non-empty dblatex/contrib/example
rmdir --parents --ignore-fail-on-non-empty dblatex/specs
echo "Removed former conffiles below /etc/dblatex/ as they were unchanged."
rm --force $md5File
return
}
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#
case "$1" in
configure|abort-upgrade|abort-remove|abort-deconfigure)
# A call to 'mktexlsr' is needed to register the dblatex TeX files
# in the TeX database '/var/lib/texmf/ls-R-TEXMFMAIN'.
#
# This call won't do any harm even if it might be superfluous in
# special cases.
mktexlsr /usr/share/texmf
# Take care of former conffiles.
if [ "$1" = configure ]
then
cleanupFormerConfFiles $2
fi
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
|