#! /bin/sh

# Abort if any command returns an error value
set -e

CFGFILE=/etc/fred/whois.conf
CFGAPACHE=/etc/apache2/sites-available/whois.conf
LOGFILE=/var/log/fred/fred-whois.log

if [ "$1" = "configure" ]; then
	ucf /usr/share/doc/fred-whois/whois.conf ${CFGFILE}
	if which ucfr >/dev/null; then
		ucfr --force fred-whois ${CFGFILE}
	fi

	ucf /usr/share/doc/fred-whois/apache.conf ${CFGAPACHE}
	if which ucfr >/dev/null; then
		ucfr --force fred-whois ${CFGAPACHE}
	fi

	touch ${LOGFILE}
	chown www-data:www-data  ${LOGFILE}

	echo
	echo "Enable web whois with a2ensite 03-fred-whois and restart apache"
	echo

fi

#DEBHELPER#
