diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 02:58:04 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 02:58:04 +0000 |
commit | 89f8d515746f459d7ca8e6261bd590bd1b4602bd (patch) | |
tree | e419fa4503aef64498a4e74697f5b35b26e9c8d6 /debian/netdata-core.postinst | |
parent | Adding upstream version 1.44.3. (diff) | |
download | netdata-debian.tar.xz netdata-debian.zip |
Adding debian version 1.44.3-2.debian/1.44.3-2debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | debian/netdata-core.postinst | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/debian/netdata-core.postinst b/debian/netdata-core.postinst new file mode 100755 index 00000000..7f6b8402 --- /dev/null +++ b/debian/netdata-core.postinst @@ -0,0 +1,56 @@ +#!/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 + + # some netdata plugins must be able to read logfiles + usermod -G adm netdata + + # 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 |