From: Florian Forster Date: Sun, 6 Mar 2011 08:34:22 +0000 (+0100) Subject: Build system: Automatically set capabilities flag / set-UID bit when installing as... X-Git-Tag: liboping-1.6.1~2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ec149da51a7349cd747549c484a9019515922e72;p=liboping.git Build system: Automatically set capabilities flag / set-UID bit when installing as root. --- diff --git a/src/Makefile.am b/src/Makefile.am index bc35a78..29e7d92 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -51,3 +51,16 @@ if BUILD_WITH_LIBRT noping_LDADD += -lrt endif endif # BUILD_WITH_LIBNCURSES + +install-exec-hook: + @if test "x0" = "x$$UID"; then \ + if test "xLinux" = "x`uname -s`"; then \ + echo "Setting CAP_NET_RAW capability on binaries."; \ + setcap cap_net_raw=ep $(DESTDIR)$(bindir)/oping; \ + setcap cap_net_raw=ep $(DESTDIR)$(bindir)/noping; \ + else \ + echo "Setting set-UID bit on binaries."; \ + chmod u+s $(DESTDIR)$(bindir)/oping; \ + chmod u+s $(DESTDIR)$(bindir)/noping; \ + fi; \ + fi