#!/bin/sh -e
#
# post install script for Dents
#
# Michel Onstein <michel@promera.nl>
#

case "$1" in
	configure)
		# Configure stuff continues below
	;;

	abort-upgrade|abort-remove|abort-deconfigure)
		exit 0
	;;

	*)
		echo "postinst called with unknown argument \`$1'" >&2
		exit 0
	;;
esac

# Install our start stop script
update-rc.d dents defaults 19 >/dev/null


if [ -f /var/dents/named.boot ]
then
	echo "An existing Dents configuration has been found, this will be"
	echo "used. Use dentsconfig to modify your configuration."
	echo
else
	dentsconfig --no-reload
fi

echo -n "Start Dents nameserver daemon now? [Y] "
read yn
test -n "$yn" || yn="Y"

case "$yn" in
    [Nn]*)
        echo "Not started; to start Dents later execute: /etc/init.d/dents start"
        echo -n "Press [ENTER] "
        read line
    ;;

    *)
        /etc/init.d/dents start
    ;;
esac

exit 0

