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 126
|
#! /bin/sh -e
# postinst script for f-prot-installer
#
# see: dh_installdeb(1)
# 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 /usr/share/doc/packaging-manual/
#
# quoting from the policy:
# Any necessary prompting should almost always be confined to the
# post-installation script, and should be protected with a conditional
# so that unnecessary prompting doesn't happen if a package's
# installation fails and the `postinst' is called with `abort-upgrade',
# `abort-remove' or `abort-deconfigure'.
# use debconf
. /usr/share/debconf/confmodule
do_abort()
{
db_fset f-prot-installer/failed seen false
db_input low f-prot-installer/failed || true
db_go
db_set f-prot-installer/configured false
exit 1
}
case "$1" in
configure)
# move wrongly placed files
# We can probably do this anyway,
# regardless of wheather installation was requested at all. If
# the actual DEF files are in /usr/lib/f-prot, this is simply
# an error and ought to be corrected
for f in /usr/lib/f-prot/*.DEF; do
if [ -f $f -a ! -h $f ]; then
# Tell the user that we're doing so.
echo "Moving $f to /var/lib/f-prot"
mv -f $f /var/lib/f-prot/.
echo "Symlinking /var/lib/f-prot/`basename $f` to $f"
ln -sf /var/lib/f-prot/`basename $f` $f
fi
done
#
# This cleanup applies only to f-prot versions prior to 4.0.0.
# But it shouldn't do any harm since the tests should fail gracefully.
# It should be removed in the next version or so
if [ -f /usr/lib/f-prot/check-updates.sh ]; then
cd /usr/lib/f-prot
mv -f check-updates.sh check-updates || do_abort
fi
if [ -L /usr/share/man/man8/check-updates.sh.8.gz ]; then
rm -f /usr/share/man/man8/check-updates.sh.8.gz || do_abort
(cd /usr/lib/f-prot/man8/; mv -f check-updates.sh.8.gz check-updates.8.gz)
fi
# First some cleanup:
rm -f /usr/share/man/man8/f-prot.8.gz
if [ -f /usr/lib/f-prot/man8/f-prot.8.gz ]; then
mkdir /usr/lib/f-prot/man1/
mv -f /usr/lib/f-prot/man8/f-prot.8.gz /usr/lib/f-prot/man1/f-prot.1.gz
(cd /usr/share/man/man1; ln -sf ../../../lib/f-prot/man1/f-prot.1.gz .)
fi
# Query db if DEFs should be updated after installation
db_get f-prot-installer/update_defs
if [ $RET = "false" ]; then
UPDATE_OPT="-n"
else
UPDATE_OPT=""
fi
# Now, let's see if installation is requested at all.
db_get f-prot-installer/reinstall
if [ $RET = false ]; then
db_set f-prot-installer/configured false
db_go
exit 0
fi
# Now, let's find out if user really wants to install
db_get f-prot-installer/action
case "$RET" in
"Install later")
do_abort
;;
"Download and install")
/usr/sbin/update-f-prot -i || do_abort
;;
"Install from file")
db_get f-prot-installer/where_are_files
/usr/sbin/update-f-prot $UPDATE_OPT -i -d $RET || do_abort
;;
*)
esac
db_set f-prot-installer/configured false
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
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
|