summaryrefslogtreecommitdiffstats
path: root/contrib/debian/netdata.postrm
blob: 4ab4eeadd972505699788f20836d6558a356b133 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /bin/sh

set -e

case "$1" in
	remove)
		;;

	purge)
		if dpkg-statoverride --list | grep -qw /var/cache/netdata; then
			dpkg-statoverride --remove /var/cache/netdata
		fi

		if dpkg-statoverride --list | grep -qw /var/lib/netdata/www; then
			dpkg-statoverride --remove /var/lib/netdata/www
		fi

		if dpkg-statoverride --list | grep -qw /var/lib/netdata; then
			dpkg-statoverride --remove /var/lib/netdata
		fi

		if getent passwd netdata >/dev/null; then
			if [ -x /usr/sbin/deluser ]; then
				deluser --quiet --system netdata || echo "Unable to remove netdata user"
			fi
		fi

		if getent group netdata >/dev/null; then
			if [ -x /usr/sbin/delgroup ]; then
				delgroup --quiet --system netdata || echo "Unable to remove netdata group"
			fi
		fi

		;;

	*)
		;;
esac

#DEBHELPER#

exit 0