add preinst script
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 28 Nov 2014 07:56:21 +0000 (08:56 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 28 Nov 2014 07:58:31 +0000 (08:58 +0100)
We need to clear ipset from older installation, because sets cannot be
swapped if there type does not match.

debian/preinst [new file with mode: 0644]

diff --git a/debian/preinst b/debian/preinst
new file mode 100644 (file)
index 0000000..a84c63c
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+    install|upgrade)
+       old_version=$2
+       if [ -e '/usr/sbin/pve-firewall' ]; then
+           if dpkg --compare-versions "$old_version" le '1.0-11' ; then
+               echo "Detected old pve-firewall version - stopping to clear old iptables rules"
+               /usr/sbin/pve-firewall stop
+           fi
+       fi
+    ;;
+
+    abort-upgrade)
+    ;;
+
+    *)
+        echo "preinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+#DEBHELPER#
+
+exit 0
\ No newline at end of file