@cryptotaxi247 / netdata-1 / commits / 9dec08180

Assorted cleanup of native packaging code. (#16640)

* Assorted cleanup of DEB packaging code. * Assorted cleanup of the RPM spec file. * DEB package fixes.

Austin S. Hemmelgarn committed Feb 6, 2024 at 09:29 UTC 9dec08180ce639ec3f8ef1ddeefbfa03509002b3
8 files changed +14 -126
contrib/debian/netdata-plugin-ebpf.postinst
+1 -1
@@ -4,7 +4,7 @@ set -e
4
5 case "$1" in
6 configure|reconfigure)
7 - chown root:netdata /usr/libexec/netdata/plugins.d/ebpf.plugin
7 + grep /usr/libexec/netdata /var/lib/dpkg/info/netdata-plugin-ebpf.list | xargs -n 30 chown root:netdata
8 chmod -f 4750 /usr/libexec/netdata/plugins.d/ebpf.plugin
9 ;;
10 esac
contrib/debian/netdata-plugin-logs-management.postinst
+1 -1
@@ -4,7 +4,7 @@ set -e
4
5 case "$1" in
6 configure|reconfigure)
7 - chown root:netdata /usr/libexec/netdata/plugins.d/logs-management.plugin
7 + grep /usr/libexec/netdata /var/lib/dpkg/info/netdata-plugin-logs-management.list | xargs -n 30 chown root:netdata
8 chmod 0750 /usr/libexec/netdata/plugins.d/logs-management.plugin
9 if ! setcap "cap_dac_read_search=eip cap_syslog=eip" /usr/libexec/netdata/plugins.d/logs-management.plugin; then
10 chmod -f 4750 /usr/libexec/netdata/plugins.d/logs-management.plugin
contrib/debian/netdata.lintian-overrides deleted
-16
@@ -1,16 +0,0 @@
1 -
2 -# See Debian policy 10.9. apps.plugin has extra capabilities, so don't let
3 -# normal users run it.
4 -netdata: non-standard-executable-perm usr/lib/*/netdata/plugins.d/apps.plugin 0754 != 0755
5 -
6 -
7 -# FontAwesome is at least in the fonts-font-awesome package, but this is
8 -# not available in wheezy. glyphicons-halflings-regular isn't currently in
9 -# a Debian package. Therefore don't complain about shipping them with netdata
10 -# for the time being.
11 -netdata: duplicate-font-file usr/share/netdata/fonts/*
12 -netdata: font-in-non-font-package usr/share/netdata/fonts/*
13 -
14 -# Files here are marked as conffiles so that local updates to the html files
15 -# isn't clobbered on upgrade.
16 -netdata: non-etc-file-marked-as-conffile var/lib/netdata/www/*
contrib/debian/netdata.postinst
+7 -24
@@ -2,29 +2,12 @@
2
3 set -e
4
5 -dpkg-maintscript-helper dir_to_symlink \
6 - /var/lib/netdata/www/.well-known /usr/share/netdata/www/.well-known 1.18.1~ netdata -- "$@"
7 -dpkg-maintscript-helper dir_to_symlink \
8 - /var/lib/netdata/www/css /usr/share/netdata/www/css 1.18.1~ netdata -- "$@"
9 -dpkg-maintscript-helper dir_to_symlink \
10 - /var/lib/netdata/www/fonts /usr/share/netdata/www/fonts 1.18.1~ netdata -- "$@"
11 -dpkg-maintscript-helper dir_to_symlink \
12 - /var/lib/netdata/www/images /usr/share/netdata/www/images 1.18.1~ netdata -- "$@"
13 -dpkg-maintscript-helper dir_to_symlink \
14 - /var/lib/netdata/www/lib /usr/share/netdata/www/lib 1.18.1~ netdata -- "$@"
15 -dpkg-maintscript-helper dir_to_symlink \
16 - /var/lib/netdata/www/static /usr/share/netdata/www/static 1.18.1~ netdata -- "$@"
17 -
5 case "$1" in
6 configure|reconfigure)
7 if ! dpkg-statoverride --list /var/lib/netdata > /dev/null 2>&1; then
8 dpkg-statoverride --update --add netdata netdata 0755 /var/lib/netdata
9 fi
10
24 - if ! dpkg-statoverride --list /var/lib/netdata/www > /dev/null 2>&1; then
25 - dpkg-statoverride --update --add root netdata 0755 /var/lib/netdata/www
26 - fi
27 -
11 if ! dpkg-statoverride --list /var/cache/netdata > /dev/null 2>&1; then
12 dpkg-statoverride --update --add netdata netdata 0755 /var/cache/netdata
13 fi
@@ -37,17 +20,17 @@ case "$1" in
20 dpkg-statoverride --update --add netdata adm 02750 /var/log/netdata
21 fi
22
23 + if ! dpkg-statoverride --list /usr/share/netdata/www > /dev/null 2>&1; then
24 + dpkg-statoverride --update --add root netdata 0755 /usr/share/netdata/www
25 + fi
26 +
27 dpkg-statoverride --force --update --add root netdata 0775 /var/lib/netdata/registry > /dev/null 2>&1
28
29 grep /usr/libexec/netdata /var/lib/dpkg/info/netdata.list | xargs -n 30 chown root:netdata
30
44 - chmod 4750 /usr/libexec/netdata/plugins.d/ndsudo
45 - chmod 4750 /usr/libexec/netdata/plugins.d/cgroup-network
46 - chmod 4750 /usr/libexec/netdata/plugins.d/local-listeners
47 - chmod 4750 /usr/libexec/netdata/plugins.d/network-viewer.plugin
48 -
49 - # Workaround for other plugins not installed directly by this package
50 - chmod -f 4750 /usr/libexec/netdata/plugins.d/ioping || true
31 + for f in ndsudo cgroup-network local-listeners ioping network-viewer.plugin; do
32 + chmod 4750 "/usr/libexec/netdata/plugins.d/${f}" || true
33 + done
34
35 ;;
36 esac
contrib/debian/netdata.postrm
+4 -13
@@ -2,19 +2,6 @@
2
3 set -e
4
5 -dpkg-maintscript-helper dir_to_symlink \
6 - /var/lib/netdata/www/.well-known /usr/share/netdata/www/.well-known 1.18.1~ netdata -- "$@"
7 -dpkg-maintscript-helper dir_to_symlink \
8 - /var/lib/netdata/www/css /usr/share/netdata/www/css 1.18.1~ netdata -- "$@"
9 -dpkg-maintscript-helper dir_to_symlink \
10 - /var/lib/netdata/www/fonts /usr/share/netdata/www/fonts 1.18.1~ netdata -- "$@"
11 -dpkg-maintscript-helper dir_to_symlink \
12 - /var/lib/netdata/www/images /usr/share/netdata/www/images 1.18.1~ netdata -- "$@"
13 -dpkg-maintscript-helper dir_to_symlink \
14 - /var/lib/netdata/www/lib /usr/share/netdata/www/lib 1.18.1~ netdata -- "$@"
15 -dpkg-maintscript-helper dir_to_symlink \
16 - /var/lib/netdata/www/static /usr/share/netdata/www/static 1.18.1~ netdata -- "$@"
17 -
5 case "$1" in
6 remove) ;;
7
@@ -27,6 +14,10 @@ case "$1" in
14 dpkg-statoverride --remove /var/lib/netdata/www
15 fi
16
17 + if dpkg-statoverride --list | grep -qw /usr/share/netdata/www; then
18 + dpkg-statoverride --remove /usr/share/netdata/www
19 + fi
20 +
21 if dpkg-statoverride --list | grep -qw /var/lib/netdata/registry; then
22 dpkg-statoverride --remove /var/lib/netdata/registry
23 fi
contrib/debian/netdata.preinst
-13
@@ -2,19 +2,6 @@
2
3 set -e
4
5 -dpkg-maintscript-helper dir_to_symlink \
6 - /var/lib/netdata/www/.well-known /usr/share/netdata/www/.well-known 1.18.1~ netdata -- "$@"
7 -dpkg-maintscript-helper dir_to_symlink \
8 - /var/lib/netdata/www/css /usr/share/netdata/www/css 1.18.1~ netdata -- "$@"
9 -dpkg-maintscript-helper dir_to_symlink \
10 - /var/lib/netdata/www/fonts /usr/share/netdata/www/fonts 1.18.1~ netdata -- "$@"
11 -dpkg-maintscript-helper dir_to_symlink \
12 - /var/lib/netdata/www/images /usr/share/netdata/www/images 1.18.1~ netdata -- "$@"
13 -dpkg-maintscript-helper dir_to_symlink \
14 - /var/lib/netdata/www/lib /usr/share/netdata/www/lib 1.18.1~ netdata -- "$@"
15 -dpkg-maintscript-helper dir_to_symlink \
16 - /var/lib/netdata/www/static /usr/share/netdata/www/static 1.18.1~ netdata -- "$@"
17 -
5 case "$1" in
6 install)
7 if ! getent group netdata > /dev/null; then
contrib/debian/rules
-10
@@ -223,15 +223,6 @@ override_dh_install:
223 #
224 cp -v packaging/installer/netdata-updater.sh $(TOP)/usr/libexec/netdata/netdata-updater.sh
225
226 - # Move files that local user shouldn't be editing to /usr/share/netdata
227 - #
228 - mkdir -p "$(TOP)/usr/share/netdata/www"
229 - for D in $$(find "$(TOP)/var/lib/netdata/www/" -maxdepth 1 -type d -printf '%f '); do \
230 - echo Relocating $$D; \
231 - mv "$(TOP)/var/lib/netdata/www/$$D" "$(TOP)/usr/share/netdata/www/$$D"; \
232 - ln -s "/usr/share/netdata/www/$$D" "$(TOP)/var/lib/netdata/www/$$D"; \
233 - done
234 -
226 # Handle eBPF code
227 #
228 if [ $(HAVE_EBPF) -eq 1 ]; then \
@@ -271,7 +262,6 @@ override_dh_fixperms:
262
263 # apps.plugin should only be runnable by the netdata user. It will be
264 # given extra capabilities in the postinst script.
274 - #
265 chmod 0750 $(TOP)-plugin-apps/usr/libexec/netdata/plugins.d/apps.plugin
266
267 # slabinfo package
netdata.spec.in
+1 -48
@@ -10,15 +10,10 @@
10 AutoReqProv: yes
11
12 # This is temporary and should eventually be resolved. This bypasses
13 -# the default rhel __os_install_p,ost which throws a python compile
13 +# the default rhel __os_install_post which throws a python compile
14 # error.
15 %global __os_install_post %{nil}
16
17 -# We don’t want LTO as it has a minimal performance impact at runtime
18 -# but a huge impact on build times (we want our CI to not take multiple
19 -# hours to finish).
20 -%global _lto_cflags %nil
21 -
17 # Use our custom CMake version from our package builders if we can’t find cmake.
18 %if 0%{?centos_ver} == 7
19 %global __cmake /cmake/bin/cmake
@@ -445,48 +440,6 @@ install -m 755 -p packaging/installer/%{name}-updater.sh "${RPM_BUILD_ROOT}%{_li
440 install -m 755 -d "${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d"
441 install -m 644 -p "%{__cmake_builddir}/system/logrotate/%{name}" "${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}"
442
448 -# ###########################################################
449 -# Install freeipmi
450 -#%if 0%{?_have_freeipmi}
451 -#install -m 4750 -p freeipmi.plugin "${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/plugins.d/freeipmi.plugin"
452 -#%endif
453 -
454 -# ###########################################################
455 -# Install apps.plugin
456 -#install -m 4750 -p apps.plugin "${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/plugins.d/apps.plugin"
457 -
458 -# ###########################################################
459 -# Install debugfs.plugin
460 -#install -m 0750 -p debugfs.plugin "${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/plugins.d/debugfs.plugin"
461 -
462 -# ###########################################################
463 -# Install systemd-journal.plugin
464 -#install -m 4750 -p systemd-journal.plugin "${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/plugins.d/systemd-journal.plugin"
465 -
466 -# ###########################################################
467 -# Install logs-management.plugin
468 -#install -m 4750 -p logs-management.plugin "${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/plugins.d/logs-management.plugin"
469 -
470 -# ###########################################################
471 -# Install perf.plugin
472 -#install -m 4750 -p perf.plugin "${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/plugins.d/perf.plugin"
473 -
474 -# ###########################################################
475 -# Install ebpf.plugin
476 -#%if 0%{?_have_ebpf}
477 -#install -m 4750 -p ebpf.plugin "${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/plugins.d/ebpf.plugin"
478 -#%endif
479 -
480 -# ###########################################################
481 -# Install cups.plugin
482 -#%if 0%{?centos_ver} != 6 && 0%{?centos_ver} != 7
483 -#install -m 0750 -p cups.plugin "${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/plugins.d/cups.plugin"
484 -#%endif
485 -
486 -# ###########################################################
487 -# Install slabinfo.plugin
488 -#install -m 4750 -p slabinfo.plugin "${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/plugins.d/slabinfo.plugin"
489 -
443 # ###########################################################
444 # Install cache and log directories
445 install -m 755 -d "${RPM_BUILD_ROOT}%{_localstatedir}/cache/%{name}"