Blob Blame History Raw
commit 63a758b4890e729195fde868e34d0015cda8b065
Author: Frank Ch. Eigler <fche@redhat.com>
Date:   Thu Aug 11 13:40:55 2016 -0400

    RHBZ1312169: make stap-prep fall back to debuginfo-install
    
    On some fedora / rhel boxes and their repo selections,
    "debuginfo-install" can sometimes fetch the right files
    even if "yum install" cannot.

diff --git a/stap-prep b/stap-prep
index 5c233bf..ca9adff 100755
--- a/stap-prep
+++ b/stap-prep
@@ -26,13 +26,17 @@ 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 \
+  yum-utils \
   $KERNEL-debuginfo-$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 to install
-        yum install -y --enablerepo=\* $NEEDED
+        yum install -y --enablerepo=\* $NEEDED ||
+	    (if expr "$NEEDED" : ".*debuginfo.*" >/dev/null;
+             then debuginfo-install -y $KERNEL-$KERN_REV.$KERN_ARCH;
+             fi)
         rpm -q $NEEDED
         check_error $? "problem installing rpm(s) $NEEDED"
     fi