preinst is in john 1.8.0-2.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
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 | #!/bin/sh
set -e
# Relocate a conffile from one location to another; it is removed iff
# unmodified, and moved iff modified.
# The undo path is postrm abort-install|abort-upgrade.
# $1 is the old pathname of the conffile,
# $2 is the new pathname of the conffile.
mv_conffile ()
{
[ ! -f "$1" ] && return
if [ -e "$2" ] ; then
echo "Not moving conffile $1 to $2; new file exists"
return
fi
orgmd5=`dpkg-query -W -f='${Conffiles}' dpkg | cut -d' ' -f3`
curmd5=`md5sum $1 |sed -e 's/ .*//'`
if [ "$orgmd5" = "$curmd5" ]; then
# conffile unmodified; prepare to remove it, allowing
# dpkg to install a new copy to the new location
# before "configuration"
echo "Preparing to remove unmodified conffile:"
echo -n " "
mv -fv $1 $1.moved_by_preinst
else
# conffile modified by admin; relocate it, causing
# dpkg to prompt, as intended
echo "Relocating modified conffile to new location:"
echo -n " "
mv -fv $1 $2
fi >&2
}
p1=/etc
p2=/etc/john
case $1 in
install|upgrade)
[ -d $p2 ] || mkdir $p2
if dpkg --compare-versions "$2" le-nl 1.6-27; then
mv_conffile $p1/john.ini $p2/john.conf
mv_conffile $p1/john-mail.conf $p2/john-mail.conf
mv_conffile $p1/john-mail.msg $p2/john-mail.msg
# No need to remove the obsolete conffile
# /etc/cron.daily/john, since old prerm does so
# unconditionally (and there is nothing we can do to stop it)
fi
;;
abort-upgrade)
# This case needs no actions here
;;
*)
echo "$0: undocumented call: $@"
exit 1
;;
esac
|