X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=debian%2Fpostinst;h=0fe9d74d1fe78dcf9c57a07e6bd8391f7805cf42;hb=3d8488c95e95efb8097e25948c810df6fd689fd2;hp=2beb6a103d4a7a4535d62395fcbf10fe75b3c22f;hpb=287632e70a394374c32cd5b5e587bcc98ef34cd0;p=iptables-cn.git diff --git a/debian/postinst b/debian/postinst index 2beb6a1..0fe9d74 100755 --- a/debian/postinst +++ b/debian/postinst @@ -34,10 +34,7 @@ if dpkg --compare-versions "$2" lt "2:1.2.11-4"; then fi # remove old iptables init script -if [ -e /etc/init.d/iptables ]; then - rm -f /etc/init.d/iptables - update-rc.d -f iptables remove -fi +update-rc.d -f iptables remove >/dev/null 2>&1 || true # check if old default file exists and import it if [ -e /etc/default/iptables ]; then @@ -50,9 +47,16 @@ fi if [ ! -e /var/lib/iptables/active ]; then if ! iptables-save | grep '^-' >/dev/null; then echo "CN: Netfilter rules empty: importing SSH bruteforce rules" - . /usr/share/doc/iptables-cn/examples/ssh-bruteforce - iptables-save > /var/lib/iptables/active + /usr/share/doc/iptables-cn/examples/ssh-bruteforce \ + 1>/dev/null 2>&1 || true fi + echo "CN: Saving current Netfilter rules to /var/lib/iptables/active" + iptables-save > /var/lib/iptables/active +fi + +# create inactive +if [ ! -e /var/lib/iptables/inactive ]; then + touch /var/lib/iptables/inactive fi # dh_installdeb will replace this with shell code automatically