netdata.postinst 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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|recnfigure)
  17. if ! getent group netdata > /dev/null; then
  18. addgroup --quiet --system netdata
  19. fi
  20. if ! getent passwd netdata > /dev/null; then
  21. adduser --quiet --system --ingroup netdata --home /var/lib/netdata --no-create-home netdata
  22. fi
  23. for item in docker nginx varnish haproxy adm nsd proxy squid ceph nobody I2C; do
  24. if getent group $item > /dev/null 2>&1; then
  25. usermod -a -G $item netdata
  26. fi
  27. done
  28. if ! dpkg-statoverride --list /var/lib/netdata > /dev/null 2>&1; then
  29. dpkg-statoverride --update --add netdata netdata 0755 /var/lib/netdata
  30. fi
  31. if ! dpkg-statoverride --list /var/lib/netdata/www > /dev/null 2>&1; then
  32. dpkg-statoverride --update --add root netdata 0755 /var/lib/netdata/www
  33. fi
  34. if ! dpkg-statoverride --list /var/cache/netdata > /dev/null 2>&1; then
  35. dpkg-statoverride --update --add netdata netdata 0755 /var/cache/netdata
  36. fi
  37. if ! dpkg-statoverride --list /var/run/netdata > /dev/null 2>&1; then
  38. dpkg-statoverride --update --add netdata netdata 0755 /var/run/netdata
  39. fi
  40. if ! dpkg-statoverride --list /var/log/netdata > /dev/null 2>&1; then
  41. dpkg-statoverride --update --add netdata adm 02750 /var/log/netdata
  42. fi
  43. dpkg-statoverride --force --update --add root netdata 0775 /var/lib/netdata/registry > /dev/null 2>&1
  44. chown -R root:netdata /usr/libexec/netdata/plugins.d
  45. setcap cap_dac_read_search,cap_sys_ptrace+ep /usr/libexec/netdata/plugins.d/apps.plugin
  46. setcap cap_dac_read_search+ep /usr/libexec/netdata/plugins.d/slabinfo.plugin
  47. if capsh --supports=cap_perfmon 2>/dev/null; then
  48. setcap cap_perfmon+ep /usr/libexec/netdata/plugins.d/perf.plugin
  49. else
  50. setcap cap_sys_admin+ep /usr/libexec/netdata/plugins.d/perf.plugin
  51. fi
  52. chmod 4750 /usr/libexec/netdata/plugins.d/cgroup-network
  53. chmod 4750 /usr/libexec/netdata/plugins.d/nfacct.plugin
  54. # Workaround if system does not have ebpf.plugin
  55. chmod -f 4750 /usr/libexec/netdata/plugins.d/ebpf.plugin || true
  56. # Workaround for other plugins not installed directly by this package
  57. chmod -f 4750 /usr/libexec/netdata/plugins.d/freeipmi.plugin || true
  58. chmod -f 4750 /usr/libexec/netdata/plugins.d/ioping || true
  59. ;;
  60. esac
  61. #DEBHELPER#
  62. exit 0