summaryrefslogtreecommitdiffstats
path: root/debian/bind9.preinst
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--debian/bind9.preinst57
1 files changed, 57 insertions, 0 deletions
diff --git a/debian/bind9.preinst b/debian/bind9.preinst
new file mode 100644
index 0000000..66b06ab
--- /dev/null
+++ b/debian/bind9.preinst
@@ -0,0 +1,57 @@
+#!/bin/sh
+# preinst script for bind9
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <new-preinst> `install'
+# * <new-preinst> `install' <old-version>
+# * <new-preinst> `upgrade' <old-version>
+# * <old-preinst> `abort-upgrade' <new-version>
+# for details, see https://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ install|upgrade)
+ if [ -n "$2" ] && dpkg --compare-versions "$2" lt "1:9.11.2+dfsg-6"; then
+ theirs=$(md5sum /etc/bind/named.conf.options | sed 's/ .*$//')
+ mine=56919cbc0d819c9a303a8bdeb306b5f1
+ if [ "$mine" = "$theirs" ]; then
+ if [ -n "$(dpkg-query -f '${Conffiles}' -W bind9 | grep /etc/bind/named.conf.options)" ]; then
+ # dpkg knows /etc/bind/named.conf.options as a conffile (from squeeze or older)
+ # cannot move the outdated file aside to avoid dpkg noticing deleted-by-local-admin
+ # therefore edit it in place to make it match the to-be-installed version
+ cp -p /etc/bind/named.conf.options /etc/bind/named.conf.options.dpkg-old
+ sed -i '26{/^$/d}; 23{/auth-nxdomain no;/d}' /etc/bind/named.conf.options
+ else
+ mv /etc/bind/named.conf.options /etc/bind/named.conf.options.dpkg-old
+ fi
+ fi
+ fi
+ ;;
+
+ abort-upgrade)
+ if [ ! -f "/etc/bind/named.conf.options" ] && [ -f "/etc/bind/named.conf.options.dpkg-old" ]; then
+ theirs=$(md5sum /etc/bind/named.conf.options.dpkg-old | sed 's/ .*$//')
+ mine=56919cbc0d819c9a303a8bdeb306b5f1
+ if [ "$mine" = "$theirs" ]; then
+ mv /etc/bind/named.conf.options.dpkg-old /etc/bind/named.conf.options
+ fi
+ fi
+ ;;
+
+ *)
+ echo "preinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0