r11: - reload in postinst
authorDinko Korunic <Dinko.Korunic@CARNet.hr>
Tue, 30 Oct 2007 19:31:30 +0000 (19:31 +0000)
committerDinko Korunic <Dinko.Korunic@CARNet.hr>
Tue, 30 Oct 2007 19:31:30 +0000 (19:31 +0000)
- check both named.conf and named.conf.options for lame servers logging

debian/changelog
debian/postinst

index 156c255..818e7fe 100644 (file)
@@ -1,3 +1,11 @@
+bind9-cn (2:9.2.4-2) stable; urgency=low
+
+  * korekcija postinst, pretrazi lame-servers logging i u named.conf i u
+    named.conf.options
+  * reload u postinstu
+
+ -- Dinko Korunic <kreator@carnet.hr>  Sat,  8 Sep 2007 17:40:33 +0200
+
 bind9-cn (2:9.2.4-1) stable; urgency=low
 
   * dependancy o Bind9 9.2.4
index 567dedf..d5f2e77 100755 (executable)
@@ -150,17 +150,30 @@ nameserver 161.53.2.70
 EOF
 
 # check if named.conf has lame server logging
-if [ -e /etc/bind/named.conf.options ]; then
-  lameconf=$(awk '/^logging/,/^}/ { if ($0 ~ /category lame-servers/) { print "yes"; exit } }' /etc/bind/named.conf)
-  if [ "x$lameconf" != "xyes" ]; then
-    cp /etc/bind/named.conf.options /etc/bind/named.conf.options.$$
-    cp-update bind9-cn /etc/bind/named.conf.options.$$ <<EOF
+script='/^logging/,/^}/ { if ($0 ~ /category lame-servers/) { print "yes"; exit } }'
+lameconf=
+if [ -e /etc/bind/named.conf.options -a -e /etc/bind/named.conf ]; then
+  lameconf=$(cat /etc/bind/named.conf /etc/bind/named.conf.options | awk $script)
+else
+    if [ -e /etc/bind/named.conf ]; then
+      lameconf=$(awk $script /etc/bind/named.conf)
+    fi
+fi
+if [ "x$lameconf" != "xyes" ]; then
+  if [ ! -e /etc/bind/named.conf.options ]; then
+    touch /etc/bind/named.conf.options
+  fi
+  cp /etc/bind/named.conf.options /etc/bind/named.conf.options.$$
+  cp-update bind9-cn /etc/bind/named.conf.options.$$ <<EOF
 logging {
     category lame-servers { null; };
 };
 EOF
-    cp_mv /etc/bind/named.conf.options.$$ /etc/bind/named.conf.options
-  fi
+  cp_mv /etc/bind/named.conf.options.$$ /etc/bind/named.conf.options
+    
+  # reload
+  echo "CN: Added lame-servers logging exclusion to named.conf.options"
+  rndc reload || echo "CN: Reload didn't work, please check manually"
 fi
 
 # dh_installdeb will replace this with shell code automatically