freebsd-ports/security/logcheck/files/pkg-deinstall.in
Greg Larkin 0c5958468d - Parameterized more command names and paths to ensure that installation
works with non-standard build settings.
2010-06-09 17:29:38 +00:00

33 lines
911 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