#!/bin/sh

user="logcheck"
group="logcheck"
configfiles="logcheck.conf logcheck.logfiles"

case $2 in
DEINSTALL)
	for f in ${configfiles}; do
		if diff /usr/local/etc/logcheck/${f} /usr/local/etc/logcheck/${f}.sample > /dev/null; then
			echo "---> ${f} configuration file is the same as ${f}.sample"
			rm -f /usr/local/etc/logcheck/${f}
			echo "---> Deleted /usr/local/etc/logcheck/${f}"
		else
			echo "---> /usr/local/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
;;
esac
