1
0
mirror of https://salsa.debian.org/games-team/bsdgames synced 2024-12-04 14:46:22 -05:00
bsdgames/debian/preinst

76 lines
1.8 KiB
Plaintext
Raw Normal View History

2012-02-25 11:11:48 -05:00
#!/bin/sh
# Pre-install script for python-coverage.
#
# Man page: dh_installdeb(1)
2012-02-25 11:11:48 -05:00
set -e
2010-01-15 17:31:41 -05:00
# Summary of ways this script can be called:
# * <new-preinst> install
# * <new-preinst> install <old-version>
# * <new-preinst> upgrade <old-version>
# * <old-preinst> abort-upgrade <new-version>
# For details, see the Debian Policy §6.5 in the debian-policy package
# or on the web at <URL:http://www.debian.org/doc/debian-policy/>.
action="$1"
2010-01-15 17:31:41 -05:00
SCOREFILES="
/var/games/bsdgames/atc_score
/var/games/bsdgames/battlestar.log
/var/games/bsdgames/cfscores
/var/games/bsdgames/criblog
/var/games/bsdgames/saillog
/var/games/bsdgames/snake.log
/var/games/bsdgames/snakerawscores
/var/games/bsdgames/tetris-bsd.scores"
2010-01-15 17:31:41 -05:00
# We used to keep score files in /var/lib/games, and if files are there,
# move them into the new location.
if [ -d /var/lib/games ]; then
# Have to set up directory hierarchy, since this is running as a
# preinst.
mkdir -p /var/games/bsdgames/phantasia
chown root:games /var/games/bsdgames
chmod g+rws /var/games/bsdgames
2010-01-15 17:31:41 -05:00
for file in $SCOREFILES; do
oldfile=`echo $file | sed s:/var/games/:/var/lib/games/:`
if [ -e $oldfile ]; then
if [ ! -e $file ]; then
mv -f $oldfile $file
else
rm -f $oldfile
fi
fi
done
# Delete the old directory hierarchy.
rm -rf /var/lib/games/bsdgames
fi
case "$action" in
install|upgrade|abort-upgrade)
;;
*)
printf "preinst called with unknown action %s\n" "$action" >&2
exit 1
;;
esac
2010-01-15 17:31:41 -05:00
# I didn't move robots_roll above, because the version used by old bsdgames has
# a different file format. Make sure that if I'm ugrading from pre 2.8 days,
# the old file is deleted.
if [ "$1" = "upgrade" ] && dpkg --compare-versions "$2" lt 2.8; then
rm -rf /var/games/bsdgames/robots_roll
fi
#DEBHELPER#
exit 0