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
|
#! /bin/sh
case "$1" in
failed-upgrade)
crontab -u news /etc/news/crontab.diablo
echo "Upgrade failed: restart Diablo yourself after inspection."
exit 0
;;
remove|upgrade|remove-in-favour|deconfigure-in-favour)
#
# Fall through
#
;;
*)
exit 0
;;
esac
# Stop Diablo.
echo "Trying to stop Diablo.."
/etc/init.d/diablo stop
# Remove crontab so that nothing gets run during installation
echo "Removing crontab for news.."
crontab -u news -l | \
sed -e '/^#.*\(DO NOT EDIT\|Cron version\|installed on\).*$/d' \
> /etc/news/crontab.tmp
if [ ! -s /etc/news/crontab.tmp ]
then
cp /etc/news/crontab.tmp /etc/news/crontab.diablo
fi
rm -f /etc/news/crontab.tmp
crontab -u news -r
# If we are upgrading don't remove logfiles and stuff.
if [ "$1" = upgrade ]
then
exit 0
fi
echo "Removing files in /var/log/news and /var/run/diablo.."
cd /var/log/news
rm -f dspoolout.log* daily.log*
cp /dev/null news.crit
cp /dev/null news.err
cp /dev/null news.notice
[ -f news.info ] && cp /dev/null news.info
rm -rf /var/run/diablo
rm -f /var/lib/news/{.lock,delayed-expire}
exit 0
|