summaryrefslogtreecommitdiffstats
path: root/contrib/debian/netdata.preinst
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--contrib/debian/netdata.preinst23
1 files changed, 23 insertions, 0 deletions
diff --git a/contrib/debian/netdata.preinst b/contrib/debian/netdata.preinst
index 3bbdea0b3..a5dc9107e 100644
--- a/contrib/debian/netdata.preinst
+++ b/contrib/debian/netdata.preinst
@@ -15,4 +15,27 @@ dpkg-maintscript-helper dir_to_symlink \
dpkg-maintscript-helper dir_to_symlink \
/var/lib/netdata/www/static /usr/share/netdata/www/static 1.18.1~ netdata -- "$@"
+case "$1" in
+ install)
+ if ! getent group netdata > /dev/null; then
+ addgroup --quiet --system netdata
+ fi
+
+ if ! getent passwd netdata > /dev/null; then
+ adduser --quiet --system --ingroup netdata --home /var/lib/netdata --no-create-home netdata
+ fi
+
+ for item in docker nginx varnish haproxy adm nsd proxy squid ceph nobody I2C; do
+ if getent group $item > /dev/null 2>&1; then
+ usermod -a -G $item netdata
+ fi
+ done
+ # Netdata must be able to read /etc/pve/qemu-server/* and /etc/pve/lxc/*
+ # for reading VMs/containers names, CPU and memory limits on Proxmox.
+ if [ -d "/etc/pve" ] && getent group "www-data" > /dev/null 2>&1; then
+ usermod -a -G www-data netdata
+ fi
+ ;;
+esac
+
#DEBHELPER#