summaryrefslogtreecommitdiff
path: root/debian/twoftpd-run.postrm
diff options
context:
space:
mode:
Diffstat (limited to 'debian/twoftpd-run.postrm')
-rw-r--r--debian/twoftpd-run.postrm27
1 files changed, 27 insertions, 0 deletions
diff --git a/debian/twoftpd-run.postrm b/debian/twoftpd-run.postrm
new file mode 100644
index 0000000..566dbc0
--- /dev/null
+++ b/debian/twoftpd-run.postrm
@@ -0,0 +1,27 @@
+#!/bin/sh
+set -e
+
+test "$1" = 'purge' || exit 0
+
+sv force-stop /etc/twoftpd /etc/twoftpd-anon >/dev/null 2>&1 || :
+sv force-stop /etc/twoftpd/log /etc/twoftpd-anon/log >/dev/null 2>&1 || :
+
+for i in twoftpd twoftpd-anon; do
+ rm -rf /etc/$i/supervise /etc/$i/log/supervise 2>/dev/null
+ rm -rf /var/lib/supervise/$i /var/lib/supervise/$i.log 2>/dev/null
+done
+
+for i in twoftpd twoftpd-anon; do
+ for j in '@*' current config lock state; do
+ rm -f /var/log/$i/$j
+ done
+ rmdir /var/log/$i || :
+done
+
+getent passwd ftp >/dev/null || getent passwd ftplog >/dev/null || exit 0
+if ! deluser --version >/dev/null 2>&1; then
+ echo 'deluser program not available, not removing system users "ftp", "ftplog".' >&2
+ exit 0
+fi
+deluser ftp
+deluser ftplog