]> arthur.barton.de Git - netdata.git/commitdiff
build: setuid apps.plugin if running under root
authorAlon Bar-Lev <alon.barlev@gmail.com>
Sun, 15 Nov 2015 22:46:02 +0000 (00:46 +0200)
committerAlon Bar-Lev <alon.barlev@gmail.com>
Sun, 15 Nov 2015 22:51:31 +0000 (00:51 +0200)
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
netdata.spec.in
src/Makefile.am

index af73a7b6d027d6e64eff26797a6b71e2b6330099..2aef64275f98e8f085f8358cae6f44ddf5abb90d 100644 (file)
@@ -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}
index dde90145e4bb47f8351e50aa518c50306fd9491a..1d87d5be77778b74c8cdb7bb8a8debeabbad6dba 100644 (file)
@@ -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