--- /dev/null
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ purge|remove)
+ # continue below
+ ;;
+
+ *)
+ exit 0
+ ;;
+esac
+
+# stop the service
+if [ -x /usr/sbin/invoke-rc.d ]; then
+ invoke-rc.d ossec-hids stop
+else
+ /etc/init.d/ossec-hids stop
+fi
+
+# update system v init links
+update-rc.d -f ossec-hids remove
+
+exit 0