netdata.preinst 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. install)
  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. # Netdata must be able to read /etc/pve/qemu-server/* and /etc/pve/lxc/*
  29. # for reading VMs/containers names, CPU and memory limits on Proxmox.
  30. if [ -d "/etc/pve" ] && getent group "www-data" > /dev/null 2>&1; then
  31. usermod -a -G www-data netdata
  32. fi
  33. ;;
  34. esac
  35. #DEBHELPER#