summaryrefslogtreecommitdiffstats
path: root/debian/icingaweb2-module-idoreports.postinst
blob: 209612e8a75f48c32b06f17b2a6725c974ed37eb (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
44
45
46
47
48
#!/bin/sh

set -e

MODULE="idoreports"

case "${1}" in
	configure)
		. /usr/share/debconf/confmodule

		db_get icingaweb2-module-${MODULE}/enable
		MODULE_ENABLE="${RET:-true}"

		db_stop

		if ! getent group icingaweb2 > /dev/null
		then
			groupadd --system icingaweb2 > /dev/null
		fi

		if [ "${MODULE_ENABLE}" = "true" ]
		then
			if [ ! -e "/etc/icingaweb2/enabledModules" ]
			then
				mkdir -p "/etc/icingaweb2/enabledModules"
				chown root:icingaweb2 "/etc/icingaweb2/enabledModules" > /dev/null 2>&1 || true
			fi

			ln -sf "/usr/share/icingaweb2/modules/${MODULE}" "/etc/icingaweb2/enabledModules/${MODULE}"
			chown root:icingaweb2 "/etc/icingaweb2/enabledModules/${MODULE}" > /dev/null 2>&1 || true
		else
			rm -f "/etc/icingaweb2/enabledModules/${MODULE}"
		fi
		;;

	abort-upgrade|abort-remove|abort-deconfigure)

		;;

	*)
		echo "postinst called with unknown argument: \`${1}'." >&2
		exit 1
		;;
esac

#DEBHELPER#

exit 0