summaryrefslogtreecommitdiff
path: root/net-mgmt/smokeping/pkg-deinstall
blob: e02852135496bbacdf3ab5b19e98cf7fe1dfed43 (plain) (blame)
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
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
#
# $FreeBSD$
#

echo 'Stopping Smokeping daemon.'
if [ -f ${PKG_PREFIX}/var/smokeping/smokeping.pid ]; then
	if [ -x ${PKG_PREFIX}/etc/rc.d/smokeping.sh ]; then
		${PKG_PREFIX}/etc/rc.d/smokeping.sh stop > /dev/null
	fi
	rm ${PKG_PREFIX}/var/smokeping/smokeping.pid
fi

case $2 in
POST-DEINSTALL)

	if [ ! -n "$BATCH" ]; then

		if [ -d ${PKG_PREFIX}/etc/smokeping -o -d ${PKG_PREFIX}/var/smokeping ]; then
			echo '================================================================='
			echo
			echo 'You seem to have some custom config and data.'
			echo 'The "%%USER%%" user and "%%GROUP%%" group were therefore not deleted.'
			echo
			echo 'You may delete them with:'
			echo
			echo '  pw groupdel %%GROUP%%'
			echo '  pw userdel %%USER%%'
			echo
			echo 'The config and data can be deleted with:'
			echo
			echo "  rm -R ${PKG_PREFIX}/etc/smokeping"
			echo "  rm -R ${PKG_PREFIX}/var/smokeping"
			echo
			echo '================================================================='
		else
			if pw groupdel -n %%GROUP%%; then
				echo 'Removed group "%%GROUP%%".'
			else
				echo 'Removing group "%%GROUP%%" failed...'
				exit 1
			fi

			if pw userdel -n %%USER%%; then
				echo 'Removed user "%%USER%%".'
			else
				echo 'Removing user "%%USER%%" failed...'
				exit 1
			fi
		fi
	fi

	exit 0
	;;
esac