server-1.12/debian/crossfire-server.preinst

60 lines
1.5 KiB
Bash

#! /bin/sh -e
case "$1" in
install)
# Commented out until I can find the official policy on users for debian
# create the 'crossfire' group if it doesn't exist
# grep ^crossfire: /etc/group >/dev/null || {
# /usr/sbin/groupadd crossfire > /dev/null 2>&1
# }
# create 'crossfire' user if absent
# grep ^crossfire: /etc/passwd >/dev/null || {
# /usr/sbin/useradd -d /var/games/crossfire -s /bin/false -g crossfire crossfire
# }
# check for 'crossfire' user and lock the passwd
# grep ^exim: /etc/passwd >/dev/null && {
# /usr/bin/passwd -l crossfire > /dev/null 2>&1
# }
;;
upgrade)
# Source debconf library
. /usr/share/debconf/confmodule
if [ -d /var/lib/games/crossfire/ ] ; then
db_input high crossfire-server/ask_upgrade || true
db_go || true
db_get crossfire-server/ask_upgrade || true
if [ "$RET" = "true" ] ; then
if [ ! -d /var/games/crossfire/ ] ; then
echo "moving /var/lib/games/crossfire/ to /var/games/crossfire"
mv -f /var/lib/games/crossfire/ /var/games/ || true
if [ -d /var/lib/games/crossfire/ ] ; then
if [ "`ls /var/lib/games/crossfire/ | wc -l`" -gt 0 ] ; then
echo "Some files remain in /var/lib/games/crossfire/ !"
echo "Please move them to /var/games/crossfire"
fi
fi
fi
fi
fi
db_stop || true
;;
abort-upgrade)
# do nothing
;;
*)
echo "$0: incorrect arguments: $*" >&2
exit 1
;;
esac
##DEBHELPER##