summaryrefslogtreecommitdiffstats
path: root/debian/netdata-core.postinst
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-01-01 16:05:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-01-27 20:49:02 +0000
commit9defc7d3bebf04db61dcdcbaca9fe9be79432a46 (patch)
tree48a43ce97bb0cf13c1a40c7fe38cc525a631d2e3 /debian/netdata-core.postinst
parentMoving architecture-independent plugins to interpreter specific netdata-plugi... (diff)
downloadnetdata-9defc7d3bebf04db61dcdcbaca9fe9be79432a46.tar.xz
netdata-9defc7d3bebf04db61dcdcbaca9fe9be79432a46.zip
Renaming netdata to netdata-core, making netdata a meta package depending on the (typical) netdata components that it contained before the package reshuffeling.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/netdata-core.postinst')
-rwxr-xr-xdebian/netdata-core.postinst53
1 files changed, 53 insertions, 0 deletions
diff --git a/debian/netdata-core.postinst b/debian/netdata-core.postinst
new file mode 100755
index 000000000..c99048900
--- /dev/null
+++ b/debian/netdata-core.postinst
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+set -e
+
+case "${1}" in
+ configure)
+ # creating group
+ if ! getent group netdata > /dev/null 2>&1
+ then
+ groupadd --system netdata
+ fi
+
+ # creating user
+ if ! getent passwd netdata > /dev/null 2>&1
+ then
+ useradd --system -g netdata --home-dir /var/lib/netdata --no-create-home netdata
+ mkdir -p /var/lib/netdata
+ fi
+
+ # creating directory overrides
+ for DIRECTORY in /var/cache/netdata /var/lib/netdata
+ do
+ mkdir -p "${DIRECTORY}"
+
+ if ! dpkg-statoverride --list "${DIRECTORY}" > /dev/null 2>&1
+ then
+ dpkg-statoverride --update --add netdata netdata 0755 "${DIRECTORY}"
+ fi
+ done
+
+ # handling plugin capabilities (or setuid as fallback)
+ chown -R root:netdata /usr/lib/netdata/plugins.d
+ setcap cap_dac_read_search,cap_sys_ptrace+ep /usr/lib/netdata/plugins.d/apps.plugin || \
+ chmod 4754 /usr/lib/netdata/plugins.d/apps.plugin
+
+ # handling log owner and permissions
+ chown netdata:adm /var/log/netdata
+ chmod 2750 /var/log/netdata
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`${1}'" >&2
+ exit 1
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0