summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2009-11-23 14:39:11 -0500
committerDave Brolley <brolley@redhat.com>2009-11-23 14:39:11 -0500
commit3cb882af782ac1959b247ba7ec5286c516313218 (patch)
tree098889091443eee247c861f0e0562cc1e698c242 /runtime
parentca7affd71849dd82bb8560dfbda6e9d3cbd50876 (diff)
downloadsystemtap-steved-3cb882af782ac1959b247ba7ec5286c516313218.tar.gz
systemtap-steved-3cb882af782ac1959b247ba7ec5286c516313218.tar.xz
systemtap-steved-3cb882af782ac1959b247ba7ec5286c516313218.zip
Rework setting of group and permissions on generated files and directories.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/uprobes/Makefile29
1 files changed, 21 insertions, 8 deletions
diff --git a/runtime/uprobes/Makefile b/runtime/uprobes/Makefile
index 3be92ff6..443797b8 100644
--- a/runtime/uprobes/Makefile
+++ b/runtime/uprobes/Makefile
@@ -9,6 +9,13 @@ CLEAN_FILES := $(shell echo *.mod.c *.ko *.o .*.cmd *~ *.sgn)
CLEAN_FILES += Module.markers modules.order Module.symvers
CLEAN_DIRS := .tmp_versions
+# Build the module and sign it.
+# Make sure that all of the generated files belong the group stap-server
+# and are writable by that group. This is so that the stap-server service
+# can build or rebuild the module, if necessary.
+# If the chgrp and/or chmod commands fail, it is because we are not the
+# owner of the file for directory. In this case the file or directory
+# was created during a previous build and already has the correct permissions.
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
if test -f ../../../../bin/stap-sign-module; then \
@@ -18,14 +25,20 @@ default:
fi \
done \
fi
- if test `id -u` -eq 0; then \
- for f in $(CLEAN_FILES); do \
- test -e $$f && chgrp stap-server $$f && chmod 664 $$f; done; \
- for d in $(CLEAN_DIRS); do \
- test -d $$d && chgrp stap-server $$d && chmod 775 $$d; done \
- fi
- for d in $(CLEAN_DIRS); do \
- test -d $$d && chgrp stap-server $$d/* && chmod 664 $$d/*; done;
+ -chgrp stap-server $(CLEAN_FILES) 2>/dev/null
+ -chmod 664 $(CLEAN_FILES) 2>/dev/null
+ -for d in $(CLEAN_DIRS); do \
+ chgrp stap-server $$d 2>/dev/null; \
+ chmod 775 $$d 2>/dev/null; \
+ for dd in `find $$d -type d`; do \
+ chgrp stap-server $$dd 2>/dev/null; \
+ chmod 775 $$dd 2>/dev/null; \
+ done; \
+ for f in `find $$d -type f`; do \
+ chgrp stap-server $$f 2>/dev/null; \
+ chmod 664 $$f 2>/dev/null; \
+ done; \
+ done
# This target is used with "make -q" to see whether a "real" build is needed.
uprobes.ko: $(DEPENDENCIES)