2 # postinst script for bind9-cn
4 # see: dh_installdeb(1)
8 # summary of how this script can be called:
9 # * <postinst> `configure' <most-recently-configured-version>
10 # * <old-postinst> `abort-upgrade' <new version>
11 # * <conflictor's-postinst> `abort-remove' `in-favour' <package>
13 # * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
14 # <failed-install-package> <version> `removing'
15 # <conflicting-package> <version>
16 # for details, see http://www.debian.org/doc/debian-policy/ or
17 # the debian-policy package
21 configure|reconfigure)
30 # fix problem with permissions from the old package
31 if dpkg --compare-versions "$2" lt "2:1.2.11-4"; then
32 chown -f -Rh root:root /var/lib/iptables /etc/init.d/iptables \
33 /etc/default/iptables >/dev/null 2>&1
36 # remove old iptables init script
37 if [ -e /etc/init.d/iptables ]; then
38 rm -f /etc/init.d/iptables
39 update-rc.d -f iptables remove
42 # check if old default file exists and import it
43 if [ -e /etc/default/iptables ]; then
44 mv /etc/default/iptables /etc/default/iptables-cn
47 # check if there is any default netfilter policy and install default SSH
48 # REJECT recent if there is none..
49 # also, save current set of rules into active and inactive configuration
50 if [ ! -e /var/lib/iptables/active ]; then
51 . /usr/share/doc/iptables-cn/examples/ssh-bruteforce
52 iptables-save > /var/lib/iptables/active
54 if [ ! -e /var/lib/iptables/inactive ]; then
55 cp /var/lib/iptables/active /var/lib/iptables/inactive
58 # dh_installdeb will replace this with shell code automatically
59 # generated by other debhelper scripts.