From 65ffc3f32328473cb74aa5c7eca7e46bb82bd7fb Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 1 Apr 2009 19:41:55 -0700 Subject: Fix the magic run-stap wrappers even more --- run-staprun.in | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 run-staprun.in (limited to 'run-staprun.in') 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; -- cgit From b516e13ac098181536ae7281a8263e8f5b3553eb Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 2 Apr 2009 18:59:03 -0700 Subject: Really fix run-stap this time, I promise! --- run-staprun.in | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'run-staprun.in') diff --git a/run-staprun.in b/run-staprun.in index 0b5f795b..e0615556 100644 --- a/run-staprun.in +++ b/run-staprun.in @@ -1,13 +1,24 @@ -#!@PERL@ -w +#!/bin/sh -# 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'}; +srcdir='@abs_top_srcdir@' +builddir='@abs_top_builddir@' -$ENV{'SYSTEMTAP_STAPRUN'} = "sudo '$ENV{'builddir'}/staprun'"; -$ENV{'SYSTEMTAP_STAPIO'} = "$ENV{'builddir'}/stapio"; +rundir="${0%/*}" +[ "$rundir" == "$0" ] || builddir="$rundir" -exec { "$ENV{'builddir'}/staprun" } ('staprun', @ARGV); +# Absolutify the paths. +case "$srcdir" in +/*) ;; +*) srcdir=`cd "$srcdir" && pwd` || exit ;; +esac +case "$builddir" in +/*) ;; +*) builddir=`cd "$builddir" && pwd` || exit ;; +esac -exit; +exec sudo -P "SYSTEMTAP_STAPIO=${builddir}/stapio" \ + "SYSTEMTAP_STAPRUN=${builddir}/run-staprun" \ + "SYSTEMTAP_RUNTIME=${srcdir}/runtime" \ + "SYSTEMTAP_REAL_UID=`id -ru`" \ + "SYSTEMTAP_REAL_GID=`id -rg`" \ + ${builddir}/staprun ${1+"$@"} -- cgit