summaryrefslogtreecommitdiffstats
path: root/debian/icingaweb2-common.postinst
diff options
context:
space:
mode:
Diffstat (limited to 'debian/icingaweb2-common.postinst')
-rw-r--r--debian/icingaweb2-common.postinst44
1 files changed, 44 insertions, 0 deletions
diff --git a/debian/icingaweb2-common.postinst b/debian/icingaweb2-common.postinst
new file mode 100644
index 0000000..45cd51d
--- /dev/null
+++ b/debian/icingaweb2-common.postinst
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+set -e
+
+setperm() {
+ user="$1"
+ group="$2"
+ mode="$3"
+ file="$4"
+ shift 4
+ # only do something when no setting exists
+ if ! dpkg-statoverride --list "$file" >/dev/null 2>&1; then
+ chown "$user":"$group" "$file"
+ chmod "$mode" "$file"
+ fi
+}
+
+case "$1" in
+ configure)
+ if ! getent group icingaweb2 > /dev/null ; then
+ echo 'Adding system-group for icingaweb2' 1>&2
+ addgroup --system icingaweb2 >/dev/null
+ fi
+ # allow www-data to write icingaweb2 config
+ if ! getent group icingaweb2 | grep -q www-data; then
+ adduser www-data icingaweb2
+ fi
+ # secure configuration directory and allow config access
+ setperm root icingaweb2 2770 /etc/icingaweb2
+ setperm root icingaweb2 2770 /var/lib/icingaweb2
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0