netdata-plugin-perf.postinst 572 B

1234567891011121314151617181920212223242526
  1. #!/bin/sh
  2. set -e
  3. case "$1" in
  4. configure|reconfigure)
  5. chown root:netdata /usr/libexec/netdata/plugins.d/perf.plugin
  6. chmod 0750 /usr/libexec/netdata/plugins.d/perf.plugin
  7. if capsh --supports=cap_perfmon 2>/dev/null; then
  8. setcap cap_perfmon+ep /usr/libexec/netdata/plugins.d/perf.plugin
  9. ret="$?"
  10. else
  11. setcap cap_sys_admin+ep /usr/libexec/netdata/plugins.d/perf.plugin
  12. ret="$?"
  13. fi
  14. if [ "${ret}" -ne 0 ]; then
  15. chmod -f 4750 /usr/libexec/netdata/plugins.d/perf.plugin
  16. fi
  17. ;;
  18. esac
  19. #DEBHELPER#
  20. exit 0