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
|
#! /bin/sh
#
# $Id: postinst,v 1.1 1998/10/16 15:23:14 kooij Exp $
#
# xbat postinst script
set -e
#
# This postinst handles the following cases and tasks:
#
# 1. On initial installation:
# - create highscores data.
#
# 2. When upgrading:
# - migrate old highscores to new location.
#
# 3. When aborting an upgrade:
# - restore higscores in old location.
#
# In all cases:
# - trigger menu system update
#
#
olderscoredir=/var/lib/games/Xbat/Score
oldscoredir=/var/games/Xbat/Score
newscoredir=/var/games/xbat
scorelibdir=/usr/share/games/xbat/Score
case "$1" in
configure)
#
# Register sgid binary
#
if ! dpkg-statoverride --list /usr/games/xbat >/dev/null 2>&1; then
dpkg-statoverride --update --add root games 2755 /usr/games/xbat
fi
#
# Check if the dynamic highscore files are in place.
#
# The highscore directory is included by the package,
# but dynamic data must not be, or else it would be
# replaced every time the package is upgraded.
#
# If there are any in the old location, then this must
# either be an upgrade or a reinstallation after a
# remove-but-not-purge, and we want to reuse the old
# highscores data.
#
# If there is no trace of existing higscores, copy the
# distributed highscores in place.
#
for a in 0 1 2 3 4 ; do
if [ ! -e $newscoredir/top10-$a.txt ]; then
if [ -e $oldscoredir/top10-$a.txt ]; then
mv $oldscoredir/top10-$a.txt $newscoredir
else
if [ -e $olderscoredir/top10-$a.txt ]; then
mv $olderscoredir/top10-$a.txt $newscoredir
else
cp $scorelibdir/top10-$a.txt $newscoredir
fi
fi
fi
# Fix up system-wide highscores permissions.
chown root.games $newscoredir/top10-$a.txt
chmod 0664 $newscoredir/top10-$a.txt
done
#
# Finalize highscores migration from /var/lib/games to /var/games
#
if [ -d /var/lib/games/Xbat ]; then
rm -rf /var/lib/games/Xbat
fi
if [ -d /var/games/Xbat ]; then
rm -rf /var/games/Xbat
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
# Here I think we should put the highscores back
# I'm studying on it :-)
echo "$0 called with exceptional argument \`$1'" >&2;
echo " something bad may be getting away uncaught here" >&2
;;
*)
echo "$0 called with unknown argument \`$1'" >&2;
echo " please check bugs.debian.org/xbat" >&2;
exit 0;
;;
esac
#
# reregister menufile data with Debian menu system
#
if [ -x /usr/bin/update-menus ] ; then
update-menus
fi
|