#!/bin/sh -e

. /usr/share/debconf/confmodule


case "$1" in
    configure)

    touch /etc/bind/slavedns.conf
    # Configure alternc-slavedns (if an alternc is installed on this server ...)
    if [ -f /usr/share/alternc/install/etc/bind/named.conf ]
	then
	
	if grep -q "include \"/etc/bind/slavedns.conf\";" /usr/share/alternc/install/etc/bind/named.conf
	    then
	    echo "Named for AlternC already configured ..."
	else
	    echo "include \"/etc/bind/slavedns.conf\";" >>/usr/share/alternc/install/etc/bind/named.conf
	fi
    fi
    # Configuring bind 
    if grep -q "include \"/etc/bind/slavedns.conf\";" /etc/bind/named.conf
	then
	echo "Named already configured ..."
    else
	echo "include \"/etc/bind/slavedns.conf\";" >>/etc/bind/named.conf
	# Reloading bind : 
	if [ -e "/etc/init.d/bind" ]
	    then
	    /etc/init.d/bind reload
	fi
	if [ -e "/etc/init.d/bind9" ]
	    then
	    /etc/init.d/bind9 reload
	fi
    fi
    
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
