From 17da0af6deae5f8dc94e5dabac4e4005b02654b6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 1 Jan 2019 15:54:20 +0100 Subject: Moving netdata plugins to /usr/lib/netdata. This dropps multiarch-coinstallability, however, all but a few plugins are arch-indep anyway, and otherwise the package splitting woudn't work. Signed-off-by: Daniel Baumann --- debian/control | 1 - debian/netdata.install | 25 ++++++++++------------ debian/netdata.postinst | 53 ++++++++++++++++++++++++++++++++++++++++++++++ debian/netdata.postinst.in | 53 ---------------------------------------------- debian/rules | 22 ++++++------------- 5 files changed, 71 insertions(+), 83 deletions(-) create mode 100755 debian/netdata.postinst delete mode 100755 debian/netdata.postinst.in diff --git a/debian/control b/debian/control index e754ef01a..6c0346a08 100644 --- a/debian/control +++ b/debian/control @@ -48,7 +48,6 @@ Description: real-time performance monitoring Package: netdata-data Section: net Architecture: all -Multi-Arch: foreign Depends: fonts-font-awesome, libjs-bootstrap, diff --git a/debian/netdata.install b/debian/netdata.install index 96646e8f8..9cc271cd5 100644 --- a/debian/netdata.install +++ b/debian/netdata.install @@ -1,14 +1,11 @@ -/etc/netdata/ -/usr/sbin -/usr/lib/*/netdata/charts.d/*.sh -/usr/lib/*/netdata/conf.d -/usr/lib/*/netdata/node.d/*.js -/usr/lib/*/netdata/node.d/node_modules -/usr/lib/*/netdata/plugins.d/*.plugin -/usr/lib/*/netdata/plugins.d/*.sh -/usr/lib/*/netdata/plugins.d/*.sh.inc -/usr/lib/*/netdata/plugins.d/cgroup-network -/usr/lib/*/netdata/python.d/*.py -/usr/lib/*/netdata/python.d/python_modules - -debian/netdata.conf /etc/netdata/ +/etc/netdata +/usr/lib/netdata/charts.d/*.sh +/usr/lib/netdata/conf.d +/usr/lib/netdata/node.d/*.js +/usr/lib/netdata/node.d/node_modules +/usr/lib/netdata/plugins.d/*.plugin +/usr/lib/netdata/plugins.d/*.sh +/usr/lib/netdata/plugins.d/*.sh.inc +/usr/lib/netdata/plugins.d/cgroup-network +/usr/lib/netdata/python.d/*.py +/usr/lib/netdata/python.d/python_modules diff --git a/debian/netdata.postinst b/debian/netdata.postinst new file mode 100755 index 000000000..c99048900 --- /dev/null +++ b/debian/netdata.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 diff --git a/debian/netdata.postinst.in b/debian/netdata.postinst.in deleted file mode 100755 index 157cde366..000000000 --- a/debian/netdata.postinst.in +++ /dev/null @@ -1,53 +0,0 @@ -#!/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/@DEB_HOST_MULTIARCH@/netdata/plugins.d - setcap cap_dac_read_search,cap_sys_ptrace+ep /usr/lib/@DEB_HOST_MULTIARCH@/netdata/plugins.d/apps.plugin || \ - chmod 4754 /usr/lib/@DEB_HOST_MULTIARCH@/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 diff --git a/debian/rules b/debian/rules index 9eadb4c0b..6ba1e769a 100755 --- a/debian/rules +++ b/debian/rules @@ -1,8 +1,5 @@ #!/usr/bin/make -f -# Find the arch we are building for, as this determines -# the location of plugins in /usr/lib -DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) TOP = $(CURDIR)/debian/netdata VERSION := $(shell dpkg-parsechangelog -SVersion) @@ -17,8 +14,6 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all export DEB_CFLAGS_MAINT_APPEND = -Wall -O3 export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed -MULTIARCH_INSTALL = debian/netdata.postinst - %: dh $@ @@ -44,12 +39,9 @@ override_dh_autoreconf_clean: dh_autoreconf_clean override_dh_auto_configure: - dh_auto_configure -- --libexecdir=/usr/lib/$(DEB_HOST_MULTIARCH) --disable-x86-sse --enable-plugin-freeipmi --with-math - -$(MULTIARCH_INSTALL): % : %.in - sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@ + dh_auto_configure -- --libdir=/usr/lib --libexecdir=/usr/lib --disable-x86-sse --enable-plugin-freeipmi --with-math -override_dh_install: $(MULTIARCH_INSTALL) +override_dh_install: # Remove unneeded .keep files find debian/tmp -name .keep -delete @@ -69,8 +61,8 @@ override_dh_fixperms-arch: # apps.plugin should only be runnable by the netdata user. It will be # given extra capabilities in the postinst script. # - chmod 0754 $(TOP)/usr/lib/$(DEB_HOST_MULTIARCH)/netdata/plugins.d/apps.plugin - chmod 0644 $(TOP)/usr/lib/$(DEB_HOST_MULTIARCH)/netdata/plugins.d/loopsleepms.sh.inc - chmod 4754 $(TOP)/usr/lib/$(DEB_HOST_MULTIARCH)/netdata/plugins.d/freeipmi.plugin - chmod 0644 $(TOP)/usr/lib/$(DEB_HOST_MULTIARCH)/netdata/charts.d/*.sh - chmod 0644 $(TOP)/usr/lib/$(DEB_HOST_MULTIARCH)/netdata/python.d/*.py + chmod 0754 $(TOP)/usr/lib/netdata/plugins.d/apps.plugin + chmod 0644 $(TOP)/usr/lib/netdata/plugins.d/loopsleepms.sh.inc + chmod 4754 $(TOP)/usr/lib/netdata/plugins.d/freeipmi.plugin + chmod 0644 $(TOP)/usr/lib/netdata/charts.d/*.sh + chmod 0644 $(TOP)/usr/lib/netdata/python.d/*.py -- cgit v1.2.3