[PATCH 2/2] Handle installation without stapusr group
David Ward
david.ward@ll.mit.edu
Wed Jan 30 05:38:00 GMT 2019
Do not cause "make install" to return an error if the stapusr group
cannot be found or created (even as root); continue without setting
the ownership or mode of the installed executables. This may happen
when building distribution packages using fakeroot (it was observed
on Arch Linux). This step is often performed directly in the build
files of the distribution package instead (such as systemtap.spec).
---
stapbpf/Makefile.am | 6 +++---
stapbpf/Makefile.in | 6 +++---
staprun/Makefile.am | 6 +++---
staprun/Makefile.in | 6 +++---
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/stapbpf/Makefile.am b/stapbpf/Makefile.am
index 1626e4a..ba18697 100644
--- a/stapbpf/Makefile.am
+++ b/stapbpf/Makefile.am
@@ -42,9 +42,9 @@ git_version.stamp ../git_version.h:
# Why the "id -u" condition? This way, an unprivileged user can run
# make install, and have "sudo stap ...." or "sudo stapbpf ...." work later.
install-exec-hook:
- if [ `id -u` -eq 0 ]; then \
- (getent group stapusr >/dev/null || groupadd -f -g 156 -r stapusr) \
- && chgrp stapusr "$(DESTDIR)$(bindir)/stapbpf" \
+ if [ `id -u` -eq 0 ] && (getent group stapusr >/dev/null \
+ || groupadd -f -g 156 -r stapusr); then \
+ chgrp stapusr "$(DESTDIR)$(bindir)/stapbpf" \
&& chmod 04110 "$(DESTDIR)$(bindir)/stapbpf"; \
fi
endif
diff --git a/stapbpf/Makefile.in b/stapbpf/Makefile.in
index 487da04..e3a3146 100644
--- a/stapbpf/Makefile.in
+++ b/stapbpf/Makefile.in
@@ -848,9 +848,9 @@ uninstall-man: uninstall-man8
# Why the "id -u" condition? This way, an unprivileged user can run
# make install, and have "sudo stap ...." or "sudo stapbpf ...." work later.
@HAVE_BPF_DECLS_TRUE@install-exec-hook:
-@HAVE_BPF_DECLS_TRUE@ if [ `id -u` -eq 0 ]; then \
-@HAVE_BPF_DECLS_TRUE@ (getent group stapusr >/dev/null || groupadd -f -g 156 -r stapusr) \
-@HAVE_BPF_DECLS_TRUE@ && chgrp stapusr "$(DESTDIR)$(bindir)/stapbpf" \
+@HAVE_BPF_DECLS_TRUE@ if [ `id -u` -eq 0 ] && (getent group stapusr >/dev/null \
+@HAVE_BPF_DECLS_TRUE@ || groupadd -f -g 156 -r stapusr); then \
+@HAVE_BPF_DECLS_TRUE@ chgrp stapusr "$(DESTDIR)$(bindir)/stapbpf" \
@HAVE_BPF_DECLS_TRUE@ && chmod 04110 "$(DESTDIR)$(bindir)/stapbpf"; \
@HAVE_BPF_DECLS_TRUE@ fi
diff --git a/staprun/Makefile.am b/staprun/Makefile.am
index f1a7a69..dd1c920 100644
--- a/staprun/Makefile.am
+++ b/staprun/Makefile.am
@@ -77,8 +77,8 @@ git_version.stamp ../git_version.h:
# Why the "id -u" condition? This way, an unprivileged user can run
# make install, and have "sudo stap ...." or "sudo staprun ...." work later.
install-exec-hook:
- if [ `id -u` -eq 0 ]; then \
- (getent group stapusr >/dev/null || groupadd -f -g 156 -r stapusr) \
- && chgrp stapusr "$(DESTDIR)$(bindir)/staprun" \
+ if [ `id -u` -eq 0 ] && (getent group stapusr >/dev/null \
+ || groupadd -f -g 156 -r stapusr); then \
+ chgrp stapusr "$(DESTDIR)$(bindir)/staprun" \
&& chmod 04110 "$(DESTDIR)$(bindir)/staprun"; \
fi
diff --git a/staprun/Makefile.in b/staprun/Makefile.in
index c518c7d..3536852 100644
--- a/staprun/Makefile.in
+++ b/staprun/Makefile.in
@@ -1161,9 +1161,9 @@ git_version.stamp ../git_version.h:
# Why the "id -u" condition? This way, an unprivileged user can run
# make install, and have "sudo stap ...." or "sudo staprun ...." work later.
install-exec-hook:
- if [ `id -u` -eq 0 ]; then \
- (getent group stapusr >/dev/null || groupadd -f -g 156 -r stapusr) \
- && chgrp stapusr "$(DESTDIR)$(bindir)/staprun" \
+ if [ `id -u` -eq 0 ] && (getent group stapusr >/dev/null \
+ || groupadd -f -g 156 -r stapusr); then \
+ chgrp stapusr "$(DESTDIR)$(bindir)/staprun" \
&& chmod 04110 "$(DESTDIR)$(bindir)/staprun"; \
fi
--
1.8.3.1
More information about the Systemtap
mailing list