summaryrefslogtreecommitdiffstats
path: root/run-staprun.in
diff options
context:
space:
mode:
Diffstat (limited to 'run-staprun.in')
-rw-r--r--run-staprun.in13
1 files changed, 13 insertions, 0 deletions
diff --git a/run-staprun.in b/run-staprun.in
new file mode 100644
index 00000000..0b5f795b
--- /dev/null
+++ b/run-staprun.in
@@ -0,0 +1,13 @@
+#!@PERL@ -w
+
+# Reset real IDs to those we had before we were sudo-invoked.
+# This gives staprun the IDs it expects from a setuid exec.
+$< = $ENV{'SUDO_UID'};
+$( = $ENV{'SUDO_GID'};
+
+$ENV{'SYSTEMTAP_STAPRUN'} = "sudo '$ENV{'builddir'}/staprun'";
+$ENV{'SYSTEMTAP_STAPIO'} = "$ENV{'builddir'}/stapio";
+
+exec { "$ENV{'builddir'}/staprun" } ('staprun', @ARGV);
+
+exit;