summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlon Bar-Lev <alon.barlev@gmail.com>2015-11-16 00:46:02 +0200
committerAlon Bar-Lev <alon.barlev@gmail.com>2015-11-16 00:51:31 +0200
commitb8c7ae6c81d78089728c64b9835b0de82121af3b (patch)
treed71b4af822573403509bd173b22a294376c4648d
parent3e672dc43359e6e911e400fea5d78773ce13d445 (diff)
build: setuid apps.plugin if running under root
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
-rw-r--r--netdata.spec.in1
-rw-r--r--src/Makefile.am19
2 files changed, 12 insertions, 8 deletions
diff --git a/netdata.spec.in b/netdata.spec.in
index af73a7b6d0..2aef64275f 100644
--- a/netdata.spec.in
+++ b/netdata.spec.in
@@ -45,7 +45,6 @@ make %{?_smp_mflags} install DESTDIR="%{buildroot}"
find "%{buildroot}" -name .keep -exec rm {} \;
%files
-%attr(4755, root, root) %{_libexecdir}/%{name}/plugins.d/apps.plugin
%attr(-, netdata, netdata) %dir %{_localstatedir}/cache/%{name}/
%attr(-, netdata, netdata) %dir %{_localstatedir}/log/%{name}/
%{_bindir}/%{name}
diff --git a/src/Makefile.am b/src/Makefile.am
index dde90145e4..1d87d5be77 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -73,10 +73,15 @@ apps_plugin_SOURCES = \
procfile.c procfile.h \
$(NULL)
-install-data-hook:
- @echo
- @echo "ATTENTION"
- @echo
- @echo "setuid bit of $(pluginsdir)/apps.plugin must be set, please execute as root:"
- @echo "chown root '$(pluginsdir)/apps.plugin' && chmod 4755 '$(pluginsdir)/apps.plugin'"
- @echo
+install-exec-hook:
+ if [ `id -u` == 0 ]; then \
+ chown root '$(DESTDIR)$(pluginsdir)/apps.plugin' && \
+ chmod 4755 '$(DESTDIR)$(pluginsdir)/apps.plugin'; \
+ else \
+ echo; \
+ echo "ATTENTION"; \
+ echo; \
+ echo "setuid bit of $(pluginsdir)/apps.plugin must be set, please execute as root:"; \
+ echo "chown root '$(pluginsdir)/apps.plugin' && chmod 4755 '$(pluginsdir)/apps.plugin'"; \
+ echo; \
+ fi