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
|
#!/bin/bash
set -e
case "$1" in
upgrade)
# check if we are downgrading to the days when our config
# was in /usr/lib/addressbook
if dpkg --compare-versions 0.7-4 gt ${2}; then
[ -d /etc/addressbook ] || exit 0
[ -d /usr/lib/addressbook ] || mkdir /usr/lib/addressbook
for file in /etc/addressbook/*; do
if [ ${file} = "/etc/addressbook/*" ]; then
# no configs to move back, skip it
exit 0
fi
# we have to give it the suffix so it stays around
# post install of the older (non-config file) version
echo moving $file to \
/usr/lib/addressbook/`basename $file`.new
mv $file /usr/lib/addressbook/`basename $file`.new
done
echo <<EOF
Note: you have downgraded your copy of addressbook to an older version.
Your config files and address data have been moved to
/usr/lib/addressbook/*.new
However, you will have to manually move your data back into place after
installation of the older version. Sorry, this is a limitation of the
older version.
Press return to continue.
EOF
read
fi
;;
remove|failed-upgrade|deconfigure)
# do not need to handle
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
;;
esac
# force uninstall, even on upgrade, so as to force reinstallation
if [ -x /usr/sbin/install-docs ]; then
install-docs -r addressbook || true
fi
#DEBHELPER#
exit 0
|