diff --git a/Makefile.am b/Makefile.am index 7b655b7..7028662 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,7 +17,7 @@ dtrace.1 \ staprun.8 bin_PROGRAMS = staprun -bin_SCRIPTS = stap-report +bin_SCRIPTS = stap-report stap-prep pkglibexec_PROGRAMS = stapio pkglibexec_SCRIPTS = stap-env oldinclude_HEADERS = includes/sys/sdt.h diff --git a/Makefile.in b/Makefile.in index eaa226e..47866b2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -380,7 +380,7 @@ AM_CXXFLAGS = -Wall -Werror man_MANS = stapprobes.3stap stapfuncs.3stap stapvars.3stap \ stapex.3stap dtrace.1 staprun.8 $(am__append_2) \ $(am__append_4) $(am__append_8) -bin_SCRIPTS = stap-report $(am__append_3) $(am__append_5) \ +bin_SCRIPTS = stap-report stap-prep $(am__append_3) $(am__append_5) \ $(am__append_10) pkglibexec_SCRIPTS = stap-env $(am__append_7) $(am__append_11) oldinclude_HEADERS = includes/sys/sdt.h diff --git a/doc/SystemTap_Beginners_Guide/en-US/extras/stapprep.sh b/doc/SystemTap_Beginners_Guide/en-US/extras/stapprep.sh deleted file mode 100755 index 3c6bf78..0000000 --- a/doc/SystemTap_Beginners_Guide/en-US/extras/stapprep.sh +++ /dev/null @@ -1,39 +0,0 @@ -#! /bin/bash -check_error() { if test $1 != 0; then echo $2; exit $1; fi } - -if [ "$#" -lt 1 ]; then - UNAME=`uname -r` # determine the kernel running on the machine -else - UNAME=$1 #user passed in uname value -fi -UNAME=`echo $UNAME | sed "s/ //"` #strip out any whitespace -KERNEL="kernel" -for VARIANT in debug kdump PAE xen; do - TMP=`echo $UNAME | sed s/$VARIANT//` - if [ "$TMP" != "$UNAME" ]; then - UNAME=$TMP; KERNEL="kernel-$VARIANT" - fi -done -KERN_ARCH=`uname -m` -KERN_REV=`echo $UNAME | sed s/.$KERN_ARCH//` # strip arch from uname -CANDIDATES="$KERNEL-$KERN_REV.$KERN_ARCH \ - $KERNEL-devel-$KERN_REV.$KERN_ARCH \ - $KERNEL-debuginfo-$KERN_REV.$KERN_ARCH \ - kernel-debuginfo-common-$KERN_REV.$KERN_ARCH" -NEEDED=`rpm --qf "%{name}-%{version}-%{release}.%{arch}\n" \ - -q $CANDIDATES | grep "is not installed" | awk '{print $2}'` -if [ "$NEEDED" != "" ]; then - echo -e "Need to install the following packages:\n$NEEDED" - if [ `id -u` = "0" ]; then #attempt download and install - DIR=`mktemp -d` || exit 1 - if [ ! -x /usr/bin/yumdownloader ]; then - echo "Need to first install yum-utils for yumdownloader" - yum install -y yum-utils - fi - yumdownloader --enablerepo="*debuginfo*" $NEEDED --destdir=$DIR - check_error $? "problem downloading rpm(s) $NEEDED" - rpm --force -ivh $DIR/*.rpm - check_error $? "problem installing rpm(s) $NEEDED" - rm -r $DIR #cleanup - fi -fi diff --git a/stap-prep b/stap-prep new file mode 100755 index 0000000..3c6bf78 --- /dev/null +++ b/stap-prep @@ -0,0 +1,39 @@ +#! /bin/bash +check_error() { if test $1 != 0; then echo $2; exit $1; fi } + +if [ "$#" -lt 1 ]; then + UNAME=`uname -r` # determine the kernel running on the machine +else + UNAME=$1 #user passed in uname value +fi +UNAME=`echo $UNAME | sed "s/ //"` #strip out any whitespace +KERNEL="kernel" +for VARIANT in debug kdump PAE xen; do + TMP=`echo $UNAME | sed s/$VARIANT//` + if [ "$TMP" != "$UNAME" ]; then + UNAME=$TMP; KERNEL="kernel-$VARIANT" + fi +done +KERN_ARCH=`uname -m` +KERN_REV=`echo $UNAME | sed s/.$KERN_ARCH//` # strip arch from uname +CANDIDATES="$KERNEL-$KERN_REV.$KERN_ARCH \ + $KERNEL-devel-$KERN_REV.$KERN_ARCH \ + $KERNEL-debuginfo-$KERN_REV.$KERN_ARCH \ + kernel-debuginfo-common-$KERN_REV.$KERN_ARCH" +NEEDED=`rpm --qf "%{name}-%{version}-%{release}.%{arch}\n" \ + -q $CANDIDATES | grep "is not installed" | awk '{print $2}'` +if [ "$NEEDED" != "" ]; then + echo -e "Need to install the following packages:\n$NEEDED" + if [ `id -u` = "0" ]; then #attempt download and install + DIR=`mktemp -d` || exit 1 + if [ ! -x /usr/bin/yumdownloader ]; then + echo "Need to first install yum-utils for yumdownloader" + yum install -y yum-utils + fi + yumdownloader --enablerepo="*debuginfo*" $NEEDED --destdir=$DIR + check_error $? "problem downloading rpm(s) $NEEDED" + rpm --force -ivh $DIR/*.rpm + check_error $? "problem installing rpm(s) $NEEDED" + rm -r $DIR #cleanup + fi +fi diff --git a/systemtap.spec b/systemtap.spec index d29dac5..a65868a 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -410,6 +410,7 @@ exit 0 %{_bindir}/stap %{_bindir}/stap-report +%{_bindir}/stap-prep %{_mandir}/man1/* %{_mandir}/man3/*