netdata.postinst 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #! /bin/sh
  2. set -e
  3. dpkg-maintscript-helper dir_to_symlink \
  4. /var/lib/netdata/www/.well-known /usr/share/netdata/www/.well-known 1.18.1~ netdata -- "$@"
  5. dpkg-maintscript-helper dir_to_symlink \
  6. /var/lib/netdata/www/css /usr/share/netdata/www/css 1.18.1~ netdata -- "$@"
  7. dpkg-maintscript-helper dir_to_symlink \
  8. /var/lib/netdata/www/fonts /usr/share/netdata/www/fonts 1.18.1~ netdata -- "$@"
  9. dpkg-maintscript-helper dir_to_symlink \
  10. /var/lib/netdata/www/images /usr/share/netdata/www/images 1.18.1~ netdata -- "$@"
  11. dpkg-maintscript-helper dir_to_symlink \
  12. /var/lib/netdata/www/lib /usr/share/netdata/www/lib 1.18.1~ netdata -- "$@"
  13. dpkg-maintscript-helper dir_to_symlink \
  14. /var/lib/netdata/www/static /usr/share/netdata/www/static 1.18.1~ netdata -- "$@"
  15. case "$1" in
  16. configure)
  17. if [ -z "$2" ]; then
  18. if ! getent group netdata > /dev/null; then
  19. addgroup --quiet --system netdata
  20. fi
  21. if ! getent passwd netdata > /dev/null; then
  22. adduser --quiet --system --ingroup netdata --home /var/lib/netdata --no-create-home netdata
  23. fi
  24. if ! dpkg-statoverride --list /var/lib/netdata > /dev/null 2>&1; then
  25. dpkg-statoverride --update --add netdata netdata 0755 /var/lib/netdata
  26. fi
  27. if ! dpkg-statoverride --list /var/lib/netdata/www > /dev/null 2>&1; then
  28. dpkg-statoverride --update --add root netdata 0755 /var/lib/netdata/www
  29. fi
  30. if ! dpkg-statoverride --list /var/cache/netdata > /dev/null 2>&1; then
  31. dpkg-statoverride --update --add netdata netdata 0755 /var/cache/netdata
  32. fi
  33. if ! dpkg-statoverride --list /var/run/netdata > /dev/null 2>&1; then
  34. dpkg-statoverride --update --add netdata netdata 0755 /var/run/netdata
  35. fi
  36. if ! dpkg-statoverride --list /var/log/netdata > /dev/null 2>&1; then
  37. dpkg-statoverride --update --add netdata adm 02750 /var/log/netdata
  38. fi
  39. fi
  40. dpkg-statoverride --force --update --add root netdata 0775 /var/lib/netdata/registry > /dev/null 2>&1
  41. chown -R root:netdata /usr/libexec/netdata/plugins.d
  42. setcap cap_dac_read_search,cap_sys_ptrace+ep /usr/libexec/netdata/plugins.d/apps.plugin
  43. setcap cap_dac_read_search+ep /usr/libexec/netdata/plugins.d/slabinfo.plugin
  44. capsh --supports=cap_perfmon 2>/dev/null && setcap cap_perfmon+ep /usr/libexec/netdata/plugins.d/perf.plugin || setcap cap_sys_admin+ep /usr/libexec/netdata/plugins.d/perf.plugin
  45. chmod 4750 /usr/libexec/netdata/plugins.d/cgroup-network
  46. chmod 4750 /usr/libexec/netdata/plugins.d/nfacct.plugin
  47. # Workaround if system does not have ebpf.plugin
  48. chmod -f 4750 /usr/libexec/netdata/plugins.d/ebpf.plugin || true
  49. # Workaround for other plugins not installed directly by this package
  50. chmod -f 4750 /usr/libexec/netdata/plugins.d/freeipmi.plugin || true
  51. chmod -f 4750 /usr/libexec/netdata/plugins.d/ioping || true
  52. ;;
  53. esac
  54. #DEBHELPER#
  55. exit 0