summaryrefslogtreecommitdiffstats
path: root/packaging/cmake/pkg-files
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/cmake/pkg-files')
-rw-r--r--packaging/cmake/pkg-files/copyright10
-rwxr-xr-xpackaging/cmake/pkg-files/deb/ebpf-code-legacy/postinst11
-rwxr-xr-xpackaging/cmake/pkg-files/deb/ebpf-code-legacy/preinst11
-rw-r--r--packaging/cmake/pkg-files/deb/netdata/conffiles5
-rw-r--r--packaging/cmake/pkg-files/deb/netdata/etc/default/netdata3
-rwxr-xr-xpackaging/cmake/pkg-files/deb/netdata/etc/init.d/netdata56
-rwxr-xr-xpackaging/cmake/pkg-files/deb/netdata/postinst53
-rwxr-xr-xpackaging/cmake/pkg-files/deb/netdata/postrm55
-rwxr-xr-xpackaging/cmake/pkg-files/deb/netdata/preinst26
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-apps/postinst15
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-apps/preinst11
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-chartsd/postinst11
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-chartsd/preinst11
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-cups/postinst11
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-cups/preinst11
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-debugfs/postinst15
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-debugfs/preinst11
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-ebpf/postinst12
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-ebpf/preinst11
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-freeipmi/postinst12
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-freeipmi/preinst11
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-go/postinst15
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-go/preinst11
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-logs-management/postinst15
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-logs-management/preinst11
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-network-viewer/postinst15
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-network-viewer/preinst11
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-nfacct/postinst12
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-nfacct/preinst11
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-perf/postinst18
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-perf/preinst11
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-pythond/postinst11
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-pythond/preinst11
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-slabinfo/postinst15
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-slabinfo/preinst11
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-systemd-journal/postinst15
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-systemd-journal/preinst11
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-xenstat/postinst12
-rwxr-xr-xpackaging/cmake/pkg-files/deb/plugin-xenstat/preinst11
39 files changed, 599 insertions, 0 deletions
diff --git a/packaging/cmake/pkg-files/copyright b/packaging/cmake/pkg-files/copyright
new file mode 100644
index 00000000..085580ea
--- /dev/null
+++ b/packaging/cmake/pkg-files/copyright
@@ -0,0 +1,10 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: Netdata
+Upstream-Contact: Costa Tsaousis <costa@tsaousis.gr>
+Source: https://github.com/netdata/netdata
+
+Files: *
+Copyright: 2014-2016, Costa Tsaousis
+License: GPL-3+
+ On Debian systems, the complete text of the GNU General Public
+ License version 3 can be found in /usr/share/common-licenses/GPL-3.
diff --git a/packaging/cmake/pkg-files/deb/ebpf-code-legacy/postinst b/packaging/cmake/pkg-files/deb/ebpf-code-legacy/postinst
new file mode 100755
index 00000000..d6fe8672
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/ebpf-code-legacy/postinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ configure|reconfigure)
+ grep /usr/libexec/netdata /var/lib/dpkg/info/netdata-ebpf-code-legacy.list | xargs -n 30 chown root:netdata
+ ;;
+esac
+
+exit 0
diff --git a/packaging/cmake/pkg-files/deb/ebpf-code-legacy/preinst b/packaging/cmake/pkg-files/deb/ebpf-code-legacy/preinst
new file mode 100755
index 00000000..57615ec0
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/ebpf-code-legacy/preinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ install)
+ if ! getent group netdata > /dev/null; then
+ addgroup --quiet --system netdata
+ fi
+ ;;
+esac
diff --git a/packaging/cmake/pkg-files/deb/netdata/conffiles b/packaging/cmake/pkg-files/deb/netdata/conffiles
new file mode 100644
index 00000000..1ec90254
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/netdata/conffiles
@@ -0,0 +1,5 @@
+/etc/default/netdata
+/etc/init.d/netdata
+/etc/logrotate.d/netdata
+/etc/netdata/netdata.conf
+/etc/netdata/netdata-updater.conf
diff --git a/packaging/cmake/pkg-files/deb/netdata/etc/default/netdata b/packaging/cmake/pkg-files/deb/netdata/etc/default/netdata
new file mode 100644
index 00000000..0bc847fe
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/netdata/etc/default/netdata
@@ -0,0 +1,3 @@
+# Extra arguments to pass to netdata
+#
+EXTRA_OPTS="-P /var/run/netdata/netdata.pid"
diff --git a/packaging/cmake/pkg-files/deb/netdata/etc/init.d/netdata b/packaging/cmake/pkg-files/deb/netdata/etc/init.d/netdata
new file mode 100755
index 00000000..c2706caa
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/netdata/etc/init.d/netdata
@@ -0,0 +1,56 @@
+#!/bin/sh
+# Start/stop the netdata daemon.
+#
+### BEGIN INIT INFO
+# Provides: netdata
+# Required-Start: $remote_fs
+# Required-Stop: $remote_fs
+# Should-Start: $network
+# Should-Stop: $network
+# Default-Start: 2 3 4 5
+# Default-Stop:
+# Short-Description: Real-time charts for system monitoring
+# Description: Netdata is a daemon that collects data in realtime (per second)
+# and presents a web site to view and analyze them. The presentation
+# is also real-time and full of interactive charts that precisely
+# render all collected values.
+### END INIT INFO
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+DESC="netdata daemon"
+NAME=netdata
+DAEMON=/usr/sbin/netdata
+PIDFILE=/var/run/netdata/netdata.pid
+SCRIPTNAME=/etc/init.d/"$NAME"
+
+test -f $DAEMON || exit 0
+
+. /lib/lsb/init-functions
+
+[ -r /etc/default/netdata ] && . /etc/default/netdata
+
+case "$1" in
+start) log_daemon_msg "Starting real-time system monitoring" "netdata"
+ start_daemon -p $PIDFILE $DAEMON -P $PIDFILE $EXTRA_OPTS
+ log_end_msg $?
+ ;;
+stop) log_daemon_msg "Stopping real-time system monitoring" "netdata"
+ killproc -p $PIDFILE $DAEMON
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && [ -e "$PIDFILE" ] && rm -f $PIDFILE
+ log_end_msg $RETVAL
+ # wait for plugins to exit
+ sleep 1
+ ;;
+restart|force-reload) log_daemon_msg "Restarting real-time system monitoring" "netdata"
+ $0 stop
+ $0 start
+ ;;
+status)
+ status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
+ ;;
+*) log_action_msg "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}"
+ exit 2
+ ;;
+esac
+exit 0
diff --git a/packaging/cmake/pkg-files/deb/netdata/postinst b/packaging/cmake/pkg-files/deb/netdata/postinst
new file mode 100755
index 00000000..97593c23
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/netdata/postinst
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ configure|reconfigure)
+ if ! dpkg-statoverride --list /var/lib/netdata > /dev/null 2>&1; then
+ dpkg-statoverride --update --add netdata netdata 0755 /var/lib/netdata
+ fi
+
+ if ! dpkg-statoverride --list /var/cache/netdata > /dev/null 2>&1; then
+ dpkg-statoverride --update --add netdata netdata 0755 /var/cache/netdata
+ fi
+
+ if ! dpkg-statoverride --list /var/run/netdata > /dev/null 2>&1; then
+ dpkg-statoverride --update --add netdata netdata 0755 /var/run/netdata
+ fi
+
+ if ! dpkg-statoverride --list /var/log/netdata > /dev/null 2>&1; then
+ dpkg-statoverride --update --add netdata adm 02750 /var/log/netdata
+ fi
+
+ if ! dpkg-statoverride --list /usr/share/netdata/www > /dev/null 2>&1; then
+ dpkg-statoverride --update --add root netdata 0755 /usr/share/netdata/www
+ fi
+
+ dpkg-statoverride --force --update --add root netdata 0775 /var/lib/netdata/registry > /dev/null 2>&1
+
+ grep /usr/libexec/netdata /var/lib/dpkg/info/netdata.list | xargs -n 30 chown root:netdata
+
+ for f in ndsudo cgroup-network local-listeners ioping.plugin; do
+ chmod 4750 "/usr/libexec/netdata/plugins.d/${f}" || true
+ done
+
+ ;;
+esac
+
+if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
+ deb-systemd-helper unmask 'netdata.service' >/dev/null || true
+
+ if deb-systemd-helper --quiet was-enabled 'netdata.service'; then
+ deb-systemd-helper enable 'netdata.service' >/dev/null || true
+ else
+ deb-systemd-helper update-state 'netdata.service' >/dev/null || true
+ fi
+
+ if [ -z "${DPKG_ROOT:-}" ] && [ -d /run/systemd/system ]; then
+ systemctl --system daemon-reload >/dev/null || true
+ deb-systemd-invoke restart 'netdata.service' >/dev/null || true
+ fi
+fi
+
+exit 0
diff --git a/packaging/cmake/pkg-files/deb/netdata/postrm b/packaging/cmake/pkg-files/deb/netdata/postrm
new file mode 100755
index 00000000..7a636863
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/netdata/postrm
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ remove) ;;
+
+ purge)
+ if dpkg-statoverride --list | grep -qw /var/cache/netdata; then
+ dpkg-statoverride --remove /var/cache/netdata
+ fi
+
+ if dpkg-statoverride --list | grep -qw /var/lib/netdata/www; then
+ dpkg-statoverride --remove /var/lib/netdata/www
+ fi
+
+ if dpkg-statoverride --list | grep -qw /usr/share/netdata/www; then
+ dpkg-statoverride --remove /usr/share/netdata/www
+ fi
+
+ if dpkg-statoverride --list | grep -qw /var/lib/netdata/registry; then
+ dpkg-statoverride --remove /var/lib/netdata/registry
+ fi
+
+ if dpkg-statoverride --list | grep -qw /var/lib/netdata; then
+ dpkg-statoverride --remove /var/lib/netdata
+ fi
+
+ if dpkg-statoverride --list | grep -qw /var/run/netdata; then
+ dpkg-statoverride --remove /var/run/netdata
+ fi
+
+ if dpkg-statoverride --list | grep -qw /var/log/netdata; then
+ dpkg-statoverride --remove /var/log/netdata
+ fi
+ ;;
+
+ *) ;;
+
+esac
+
+if [ "$1" = "remove" ]; then
+ if [ -x "/usr/bin/deb-systemd-helper" ]; then
+ deb-systemd-helper mask 'netdata.service' >/dev/null || true
+ fi
+fi
+
+if [ "$1" = "purge" ]; then
+ if [ -x "/usr/bin/deb-systemd-helper" ]; then
+ deb-systemd-helper purge 'netdata.service' >/dev/null || true
+ deb-systemd-helper unmask 'netdata.service' >/dev/null || true
+ fi
+fi
+
+exit 0
diff --git a/packaging/cmake/pkg-files/deb/netdata/preinst b/packaging/cmake/pkg-files/deb/netdata/preinst
new file mode 100755
index 00000000..6dcf201d
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/netdata/preinst
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+set -e
+
+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
diff --git a/packaging/cmake/pkg-files/deb/plugin-apps/postinst b/packaging/cmake/pkg-files/deb/plugin-apps/postinst
new file mode 100755
index 00000000..f4621e59
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-apps/postinst
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ configure|reconfigure)
+ chown root:netdata /usr/libexec/netdata/plugins.d/apps.plugin
+ chmod 0750 /usr/libexec/netdata/plugins.d/apps.plugin
+ if ! setcap "cap_dac_read_search=eip cap_sys_ptrace=eip" /usr/libexec/netdata/plugins.d/apps.plugin; then
+ chmod -f 4750 /usr/libexec/netdata/plugins.d/apps.plugin
+ fi
+ ;;
+esac
+
+exit 0
diff --git a/packaging/cmake/pkg-files/deb/plugin-apps/preinst b/packaging/cmake/pkg-files/deb/plugin-apps/preinst
new file mode 100755
index 00000000..57615ec0
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-apps/preinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ install)
+ if ! getent group netdata > /dev/null; then
+ addgroup --quiet --system netdata
+ fi
+ ;;
+esac
diff --git a/packaging/cmake/pkg-files/deb/plugin-chartsd/postinst b/packaging/cmake/pkg-files/deb/plugin-chartsd/postinst
new file mode 100755
index 00000000..eddb5189
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-chartsd/postinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ configure|reconfigure)
+ grep /usr/libexec/netdata /var/lib/dpkg/info/netdata-plugin-chartsd.list | xargs -n 30 chown root:netdata
+ ;;
+esac
+
+exit 0
diff --git a/packaging/cmake/pkg-files/deb/plugin-chartsd/preinst b/packaging/cmake/pkg-files/deb/plugin-chartsd/preinst
new file mode 100755
index 00000000..57615ec0
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-chartsd/preinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ install)
+ if ! getent group netdata > /dev/null; then
+ addgroup --quiet --system netdata
+ fi
+ ;;
+esac
diff --git a/packaging/cmake/pkg-files/deb/plugin-cups/postinst b/packaging/cmake/pkg-files/deb/plugin-cups/postinst
new file mode 100755
index 00000000..2490a472
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-cups/postinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ configure|reconfigure)
+ chown root:netdata /usr/libexec/netdata/plugins.d/cups.plugin
+ ;;
+esac
+
+exit 0
diff --git a/packaging/cmake/pkg-files/deb/plugin-cups/preinst b/packaging/cmake/pkg-files/deb/plugin-cups/preinst
new file mode 100755
index 00000000..57615ec0
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-cups/preinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ install)
+ if ! getent group netdata > /dev/null; then
+ addgroup --quiet --system netdata
+ fi
+ ;;
+esac
diff --git a/packaging/cmake/pkg-files/deb/plugin-debugfs/postinst b/packaging/cmake/pkg-files/deb/plugin-debugfs/postinst
new file mode 100755
index 00000000..e07ed60f
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-debugfs/postinst
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ configure|reconfigure)
+ chown root:netdata /usr/libexec/netdata/plugins.d/debugfs.plugin
+ chmod 0750 /usr/libexec/netdata/plugins.d/debugfs.plugin
+ if ! setcap "cap_dac_read_search=eip" /usr/libexec/netdata/plugins.d/debugfs.plugin; then
+ chmod -f 4750 /usr/libexec/netdata/plugins.d/debugfs.plugin
+ fi
+ ;;
+esac
+
+exit 0
diff --git a/packaging/cmake/pkg-files/deb/plugin-debugfs/preinst b/packaging/cmake/pkg-files/deb/plugin-debugfs/preinst
new file mode 100755
index 00000000..57615ec0
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-debugfs/preinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ install)
+ if ! getent group netdata > /dev/null; then
+ addgroup --quiet --system netdata
+ fi
+ ;;
+esac
diff --git a/packaging/cmake/pkg-files/deb/plugin-ebpf/postinst b/packaging/cmake/pkg-files/deb/plugin-ebpf/postinst
new file mode 100755
index 00000000..76770228
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-ebpf/postinst
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ configure|reconfigure)
+ grep /usr/libexec/netdata /var/lib/dpkg/info/netdata-plugin-ebpf.list | xargs -n 30 chown root:netdata
+ chmod -f 4750 /usr/libexec/netdata/plugins.d/ebpf.plugin
+ ;;
+esac
+
+exit 0
diff --git a/packaging/cmake/pkg-files/deb/plugin-ebpf/preinst b/packaging/cmake/pkg-files/deb/plugin-ebpf/preinst
new file mode 100755
index 00000000..57615ec0
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-ebpf/preinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ install)
+ if ! getent group netdata > /dev/null; then
+ addgroup --quiet --system netdata
+ fi
+ ;;
+esac
diff --git a/packaging/cmake/pkg-files/deb/plugin-freeipmi/postinst b/packaging/cmake/pkg-files/deb/plugin-freeipmi/postinst
new file mode 100755
index 00000000..956c9c0d
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-freeipmi/postinst
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ configure|reconfigure)
+ chown root:netdata /usr/libexec/netdata/plugins.d/freeipmi.plugin
+ chmod -f 4750 /usr/libexec/netdata/plugins.d/freeipmi.plugin
+ ;;
+esac
+
+exit 0
diff --git a/packaging/cmake/pkg-files/deb/plugin-freeipmi/preinst b/packaging/cmake/pkg-files/deb/plugin-freeipmi/preinst
new file mode 100755
index 00000000..57615ec0
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-freeipmi/preinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ install)
+ if ! getent group netdata > /dev/null; then
+ addgroup --quiet --system netdata
+ fi
+ ;;
+esac
diff --git a/packaging/cmake/pkg-files/deb/plugin-go/postinst b/packaging/cmake/pkg-files/deb/plugin-go/postinst
new file mode 100755
index 00000000..2b60067a
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-go/postinst
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ configure|reconfigure)
+ chown root:netdata /usr/libexec/netdata/plugins.d/go.d.plugin
+ chmod 0750 /usr/libexec/netdata/plugins.d/go.d.plugin
+ if ! setcap "cap_dac_read_search+epi cap_net_admin=eip cap_net_raw=eip" /usr/libexec/netdata/plugins.d/go.d.plugin; then
+ chmod -f 4750 /usr/libexec/netdata/plugins.d/go.d.plugin
+ fi
+ ;;
+esac
+
+exit 0
diff --git a/packaging/cmake/pkg-files/deb/plugin-go/preinst b/packaging/cmake/pkg-files/deb/plugin-go/preinst
new file mode 100755
index 00000000..57615ec0
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-go/preinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ install)
+ if ! getent group netdata > /dev/null; then
+ addgroup --quiet --system netdata
+ fi
+ ;;
+esac
diff --git a/packaging/cmake/pkg-files/deb/plugin-logs-management/postinst b/packaging/cmake/pkg-files/deb/plugin-logs-management/postinst
new file mode 100755
index 00000000..994b2caa
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-logs-management/postinst
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ configure|reconfigure)
+ grep /usr/libexec/netdata /var/lib/dpkg/info/netdata-plugin-logs-management.list | xargs -n 30 chown root:netdata
+ chmod 0750 /usr/libexec/netdata/plugins.d/logs-management.plugin
+ if ! setcap "cap_dac_read_search=eip cap_syslog=eip" /usr/libexec/netdata/plugins.d/logs-management.plugin; then
+ chmod -f 4750 /usr/libexec/netdata/plugins.d/logs-management.plugin
+ fi
+ ;;
+esac
+
+exit 0
diff --git a/packaging/cmake/pkg-files/deb/plugin-logs-management/preinst b/packaging/cmake/pkg-files/deb/plugin-logs-management/preinst
new file mode 100755
index 00000000..57615ec0
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-logs-management/preinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ install)
+ if ! getent group netdata > /dev/null; then
+ addgroup --quiet --system netdata
+ fi
+ ;;
+esac
diff --git a/packaging/cmake/pkg-files/deb/plugin-network-viewer/postinst b/packaging/cmake/pkg-files/deb/plugin-network-viewer/postinst
new file mode 100755
index 00000000..a388ded9
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-network-viewer/postinst
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ configure|reconfigure)
+ chown root:netdata /usr/libexec/netdata/plugins.d/network-viewer.plugin
+ chmod 0750 /usr/libexec/netdata/plugins.d/network-viewer.plugin
+ if ! setcap "cap_dac_read_search,cap_sys_admin,cap_sys_ptrace=eip" /usr/libexec/netdata/plugins.d/network-viewer.plugin; then
+ chmod -f 4750 /usr/libexec/netdata/plugins.d/network-viewer.plugin
+ fi
+ ;;
+esac
+
+exit 0
diff --git a/packaging/cmake/pkg-files/deb/plugin-network-viewer/preinst b/packaging/cmake/pkg-files/deb/plugin-network-viewer/preinst
new file mode 100755
index 00000000..57615ec0
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-network-viewer/preinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ install)
+ if ! getent group netdata > /dev/null; then
+ addgroup --quiet --system netdata
+ fi
+ ;;
+esac
diff --git a/packaging/cmake/pkg-files/deb/plugin-nfacct/postinst b/packaging/cmake/pkg-files/deb/plugin-nfacct/postinst
new file mode 100755
index 00000000..d3c8e0d2
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-nfacct/postinst
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ configure|reconfigure)
+ chown root:netdata /usr/libexec/netdata/plugins.d/nfacct.plugin
+ chmod -f 4750 /usr/libexec/netdata/plugins.d/nfacct.plugin
+ ;;
+esac
+
+exit 0
diff --git a/packaging/cmake/pkg-files/deb/plugin-nfacct/preinst b/packaging/cmake/pkg-files/deb/plugin-nfacct/preinst
new file mode 100755
index 00000000..57615ec0
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-nfacct/preinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ install)
+ if ! getent group netdata > /dev/null; then
+ addgroup --quiet --system netdata
+ fi
+ ;;
+esac
diff --git a/packaging/cmake/pkg-files/deb/plugin-perf/postinst b/packaging/cmake/pkg-files/deb/plugin-perf/postinst
new file mode 100755
index 00000000..f39d443f
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-perf/postinst
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ configure|reconfigure)
+ chown root:netdata /usr/libexec/netdata/plugins.d/perf.plugin
+ chmod 0750 /usr/libexec/netdata/plugins.d/perf.plugin
+
+ if ! setcap cap_perfmon+ep /usr/libexec/netdata/plugins.d/perf.plugin 2>/dev/null; then
+ if ! setcap cap_sys_admin+ep /usr/libexec/netdata/plugins.d/perf.plugin 2>/dev/null; then
+ chmod -f 4750 /usr/libexec/netdata/plugins.d/perf.plugin
+ fi
+ fi
+ ;;
+esac
+
+exit 0
diff --git a/packaging/cmake/pkg-files/deb/plugin-perf/preinst b/packaging/cmake/pkg-files/deb/plugin-perf/preinst
new file mode 100755
index 00000000..57615ec0
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-perf/preinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ install)
+ if ! getent group netdata > /dev/null; then
+ addgroup --quiet --system netdata
+ fi
+ ;;
+esac
diff --git a/packaging/cmake/pkg-files/deb/plugin-pythond/postinst b/packaging/cmake/pkg-files/deb/plugin-pythond/postinst
new file mode 100755
index 00000000..5a8e8c69
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-pythond/postinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ configure|reconfigure)
+ grep /usr/libexec/netdata /var/lib/dpkg/info/netdata-plugin-pythond.list | xargs -n 30 chown root:netdata
+ ;;
+esac
+
+exit 0
diff --git a/packaging/cmake/pkg-files/deb/plugin-pythond/preinst b/packaging/cmake/pkg-files/deb/plugin-pythond/preinst
new file mode 100755
index 00000000..57615ec0
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-pythond/preinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ install)
+ if ! getent group netdata > /dev/null; then
+ addgroup --quiet --system netdata
+ fi
+ ;;
+esac
diff --git a/packaging/cmake/pkg-files/deb/plugin-slabinfo/postinst b/packaging/cmake/pkg-files/deb/plugin-slabinfo/postinst
new file mode 100755
index 00000000..14976446
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-slabinfo/postinst
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ configure|reconfigure)
+ chown root:netdata /usr/libexec/netdata/plugins.d/slabinfo.plugin
+ chmod 0750 /usr/libexec/netdata/plugins.d/slabinfo.plugin
+ if ! setcap "cap_dac_read_search=eip" /usr/libexec/netdata/plugins.d/slabinfo.plugin; then
+ chmod -f 4750 /usr/libexec/netdata/plugins.d/slabinfo.plugin
+ fi
+ ;;
+esac
+
+exit 0
diff --git a/packaging/cmake/pkg-files/deb/plugin-slabinfo/preinst b/packaging/cmake/pkg-files/deb/plugin-slabinfo/preinst
new file mode 100755
index 00000000..57615ec0
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-slabinfo/preinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ install)
+ if ! getent group netdata > /dev/null; then
+ addgroup --quiet --system netdata
+ fi
+ ;;
+esac
diff --git a/packaging/cmake/pkg-files/deb/plugin-systemd-journal/postinst b/packaging/cmake/pkg-files/deb/plugin-systemd-journal/postinst
new file mode 100755
index 00000000..9a2e94fc
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-systemd-journal/postinst
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ configure|reconfigure)
+ chown root:netdata /usr/libexec/netdata/plugins.d/systemd-journal.plugin
+ chmod 0750 /usr/libexec/netdata/plugins.d/systemd-journal.plugin
+ if ! setcap "cap_dac_read_search=eip" /usr/libexec/netdata/plugins.d/systemd-journal.plugin; then
+ chmod -f 4750 /usr/libexec/netdata/plugins.d/systemd-journal.plugin
+ fi
+ ;;
+esac
+
+exit 0
diff --git a/packaging/cmake/pkg-files/deb/plugin-systemd-journal/preinst b/packaging/cmake/pkg-files/deb/plugin-systemd-journal/preinst
new file mode 100755
index 00000000..57615ec0
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-systemd-journal/preinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ install)
+ if ! getent group netdata > /dev/null; then
+ addgroup --quiet --system netdata
+ fi
+ ;;
+esac
diff --git a/packaging/cmake/pkg-files/deb/plugin-xenstat/postinst b/packaging/cmake/pkg-files/deb/plugin-xenstat/postinst
new file mode 100755
index 00000000..c7bb35df
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-xenstat/postinst
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ configure|reconfigure)
+ chown root:netdata /usr/libexec/netdata/plugins.d/xenstat.plugin
+ chmod -f 4750 /usr/libexec/netdata/plugins.d/xenstat.plugin
+ ;;
+esac
+
+exit 0
diff --git a/packaging/cmake/pkg-files/deb/plugin-xenstat/preinst b/packaging/cmake/pkg-files/deb/plugin-xenstat/preinst
new file mode 100755
index 00000000..57615ec0
--- /dev/null
+++ b/packaging/cmake/pkg-files/deb/plugin-xenstat/preinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ install)
+ if ! getent group netdata > /dev/null; then
+ addgroup --quiet --system netdata
+ fi
+ ;;
+esac