summaryrefslogtreecommitdiffstats
path: root/debian/slapd.postrm
diff options
context:
space:
mode:
Diffstat (limited to 'debian/slapd.postrm')
-rw-r--r--debian/slapd.postrm38
1 files changed, 38 insertions, 0 deletions
diff --git a/debian/slapd.postrm b/debian/slapd.postrm
new file mode 100644
index 0000000..4d7917a
--- /dev/null
+++ b/debian/slapd.postrm
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+set -e
+
+# Load debconf if available (might have been removed before purging
+# slapd)
+
+if [ -e "/usr/share/debconf/confmodule" ]; then
+ . /usr/share/debconf/confmodule
+fi
+
+# Check if the user wants the database removed on purging slapd
+remove_database_on_purge() {
+ db_get slapd/purge_database || RET=false
+ if [ "$RET" = "true" ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+if [ "$1" = "purge" ]; then
+ echo -n "Removing slapd configuration... "
+ rm -f /etc/ldap/slapd.conf 2>/dev/null || true
+ rm -rf /etc/ldap/slapd.d 2>/dev/null || true
+ echo "done."
+
+ if remove_database_on_purge; then
+ echo -n "Purging OpenLDAP database... "
+ rm -rf /var/lib/ldap || true
+ echo done
+ fi
+fi
+
+#DEBHELPER#
+
+exit 0
+