forked from ntbrock/kafka-deb-packaging
-
Notifications
You must be signed in to change notification settings - Fork 2
/
postrm
44 lines (36 loc) · 1003 Bytes
/
postrm
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
# postrm script for kafka
# based on script for sensu: https://github.com/sensu/sensu-build/blob/master/pkg_scripts/deb/postrm
set -e
# summary of how this script can be called and ordering:
# http://www.debian.org/doc/debian-policy/ch-maintainerscripts.html
# http://www.proulx.com/~bob/debian/hints/DpkgScriptOrder
purge_kafka_user_group() {
if getent passwd kafka >/dev/null; then
userdel -f kafka
fi
if getent group kafka >/dev/null; then
groupdel -f kafka
fi
}
purge_zookeeper_user_group() {
if getent passwd zookeeper >/dev/null; then
userdel -f zookeeper
fi
if getent group zookeeper >/dev/null; then
groupdel -f zookeeper
fi
}
case "$1" in
purge)
purge_kafka_user_group
purge_zookeeper_user_group
;;
remove|upgrade|abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0