#!/bin/sh
set -e

case $1 in
	configure)
		if [ ! -f /etc/smtp-refuser.conf ]; then
			touch /etc/smtp-refuser.conf ;
		fi
		if [ `wc -l </etc/smtp-refuser.conf` != 2 ]; then
			echo -n "Do you wish to configure now? [Y/n] "
			read REPLY
			case $REPLY in
				[nN]*) ;;
				*) echo ; /usr/sbin/smtp-refuserconfig ;;
			esac
			echo "smtp-refuser may be set up again by running /usr/sbin/smtp-refuserconfig.";
		fi
		;;
esac

# verisim.com no longer exists, so if this is here it's probably
# an old and unmodified copy of smtp-refuser's rules ... warn the
# administrator.

if grep -q -i 'gatekeeper\.verisim\.com' /etc/hosts.allow; then
    echo "WARNING: Your /etc/hosts.allow file appears to contain" ;
    echo "some very old and possibly harmful smtp-refuser rules." ;
    echo ;
    echo "Please read /usr/share/doc/smtp-refuser/examples/hosts.allow.sample" ;
    echo "and then manually update your /etc/hosts.allow rules." ;
    echo ;
    echo "Press a key to continue..." ;
    read REPLY
fi

#DEBHELPER#
