freebsd-ports/security/logcheck/files/pkg-deinstall.in
Greg Larkin 6e60a56931 - Fixed logcheck script silent failure in previous commit
- Added handling for crontab installation problems
- Incorported security fixes from PR opened after previous commit
- Added UPDATING entry since configuration options have changed
  fairly significantly

PR:		ports/122842
Submitted by:	Cezary Morga <cm@therek.net>
PR:		ports/127255
Submitted by:	Yasuhiro KIMURA <yasu at utahime dot org>
Reviewed by:	glarkin
Approved by:	beech (mentor, implicit)
Approved by:	portmgr (marcus)
Security:	Incorrect addition of logcheck user to wheel group
2008-09-11 00:30:09 +00:00

33 lines
895 B
Bash

#!/bin/sh
user="%%LOGCHECK_USER%%"
group="%%LOGCHECK_GROUP%%"
configfiles="logcheck.conf logcheck.logfiles"
case $2 in
DEINSTALL)
for f in ${configfiles}; do
if diff %%PREFIX%%/etc/logcheck/${f} %%PREFIX%%/etc/logcheck/${f}.sample > /dev/null; then
echo "---> ${f} configuration file is the same as ${f}.sample"
rm -f %%PREFIX%%/etc/logcheck/${f}
echo "---> Deleted %%PREFIX%%/etc/logcheck/${f}"
else
echo "---> %%PREFIX%%/etc/logcheck/${f} differs from sample file; not deleted"
fi
done
;;
POST-DEINSTALL)
if /usr/bin/crontab -u "${user}" -l > /dev/null 2>&1; then
rm -f /var/cron/tabs/${user}
echo "---> Removed crontab for \"${user}\"."
fi
if pw user show ${user} > /dev/null 2>&1; then
pw user del ${user}
echo "---> Removed user \"${user}\" and group \"${group}\"."
fi
if pw group show ${group} > /dev/null 2>&1; then
pw group del ${group}
fi
;;
esac