From: Alon Bar-Lev Date: Sun, 15 Nov 2015 22:46:02 +0000 (+0200) Subject: build: setuid apps.plugin if running under root X-Git-Tag: v1.0rc~290^2 X-Git-Url: https://arthur.barton.de/gitweb/?p=netdata.git;a=commitdiff_plain;h=b8c7ae6c81d78089728c64b9835b0de82121af3b build: setuid apps.plugin if running under root Signed-off-by: Alon Bar-Lev --- diff --git a/netdata.spec.in b/netdata.spec.in index af73a7b6..2aef6427 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 dde90145..1d87d5be 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