diff options
author | Josh Stone <jistone@redhat.com> | 2009-04-02 18:59:03 -0700 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-04-02 19:00:00 -0700 |
commit | b516e13ac098181536ae7281a8263e8f5b3553eb (patch) | |
tree | 47f4bcb56a70daee58b59b77a2043782e8612558 /run-staprun.in | |
parent | b9e80fe13706ae1c820e565e9b26f00b5f5a8dca (diff) | |
download | systemtap-steved-b516e13ac098181536ae7281a8263e8f5b3553eb.tar.gz systemtap-steved-b516e13ac098181536ae7281a8263e8f5b3553eb.tar.xz systemtap-steved-b516e13ac098181536ae7281a8263e8f5b3553eb.zip |
Really fix run-stap this time, I promise!
Diffstat (limited to 'run-staprun.in')
-rw-r--r-- | run-staprun.in | 29 |
1 files changed, 20 insertions, 9 deletions
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+"$@"} |