summaryrefslogtreecommitdiff
path: root/debian/twoftpd-run.postrm
blob: 566dbc0a8632a3049aa0f7926aafd22c22f5c944 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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