new upstream release (3.3.0); modify package compatibility for Stretch
[ossec-hids.git] / contrib / debian-packages / ossec-hids / debian / preinst
diff --git a/contrib/debian-packages/ossec-hids/debian/preinst b/contrib/debian-packages/ossec-hids/debian/preinst
new file mode 100755 (executable)
index 0000000..ba4880d
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+# preinst script for ossec-hids
+
+set -e
+
+# configuration variables
+OSSEC_HIDS_TMP_DIR="/tmp/ossec-hids"
+
+# environment configuration
+if [ ! -d ${OSSEC_HIDS_TMP_DIR} ]; then
+  mkdir ${OSSEC_HIDS_TMP_DIR}
+fi
+
+case "$1" in
+    install|upgrade)
+        # back up the current user rules
+        if [ -f /var/ossec/rules/local_rules.xml ]; then
+            cp /var/ossec/rules/local_rules.xml ${OSSEC_HIDS_TMP_DIR}/local_rules.xml
+        fi
+    ;;
+
+    abort-upgrade)
+
+    ;;
+
+    *)
+        echo "preinst called with unknown argument \`$1'" >&2
+        exit 1
+
+    ;;
+
+esac
+
+exit 0