#!/bin/sh
-# postinst script for bind9-cn
-#
-# see: dh_installdeb(1)
set -e
-# summary of how this script can be called:
-# * <postinst> `configure' <most-recently-configured-version>
-# * <old-postinst> `abort-upgrade' <new version>
-# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
-# <new-version>
-# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
-# <failed-install-package> <version> `removing'
-# <conflicting-package> <version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-#
-
-case "$1" in
- configure|reconfigure)
- # continue below
- ;;
-
- *)
- exit 0
- ;;
-esac
-
-# import CN-functions
+[ "$1" = "configure" ] || exit 0
+[ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
+
+# Load CARNet Tools
. /usr/share/carnet-tools/functions.sh
echo "CN: Making sample configurations in /usr/share/doc/bind9-cn/examples"
-echo "CN: Make sure you read them and apply *before* running Bind9 service!"
+echo "CN: Make sure you change them appropriately *before* running Bind9 service!"
#variables
cp_get_ifaddr
SERNO=`date +%Y%m%d01`
BROJ=`echo $CARNET_IPADDR | cut -d. -f4`
+echo "CN: Generating Bind9 examples in /usr/share/doc/bind9-cn/examples"
+
# make example named.conf.local
cat > /usr/share/doc/bind9-cn/examples/named.conf.local <<EOF
zone "$CARNET_DOMAINNAME" in {
options {
directory "/etc/bind";
- query-source address * port 53;
auth-nxdomain no;
allow-transfer { xfer; };
allow-recursion { trusted; };
NS $CARNET_HOSTNAME.$CARNET_DOMAINNAME.
NS bjesomar.srce.hr.
-1 PTR localhost.$CARNET_DOMAINNAME.
$BROJ PTR $CARNET_HOSTNAME.$CARNET_DOMAINNAME.
EOF
cat > /usr/share/doc/bind9-cn/examples/resolv.conf <<EOF
search $CARNET_DOMAINNAME
nameserver 127.0.0.1
-nameserver 161.53.2.70
+nameserver 161.53.123.3
+nameserver 161.53.160.3
EOF
# check if named.conf has lame server logging
rndc reload || echo "CN: Reload didn't work, please check manually"
fi
+if [ -e /etc/bind/named.conf.options ] && \
+ fgrep -q 'query-source address * port 53' \
+ /etc/bind/named.conf.options; then
+ fgrep -v 'query-source address * port 53' \
+ /etc/bind/named.conf.options > /etc/bind/named.conf.options.$$
+ cp_mv /etc/bind/named.conf.options.$$ /etc/bind/named.conf.options
+ echo "CN: Removing obsolete query-source directive"
+ rndc reload || echo "CN: Reload didn't work, please check manually"
+fi
+
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.