Blame SOURCES/rear-bz1983013.patch

6f74ef
diff --git a/usr/share/rear/conf/Linux-ppc64.conf b/usr/share/rear/conf/Linux-ppc64.conf
6f74ef
index 7e20ddc7..d7774062 100644
6f74ef
--- a/usr/share/rear/conf/Linux-ppc64.conf
6f74ef
+++ b/usr/share/rear/conf/Linux-ppc64.conf
6f74ef
@@ -1,18 +1,26 @@
6f74ef
-REQUIRED_PROGS+=( sfdisk )
6f74ef
+REQUIRED_PROGS+=( sfdisk ofpathname )
6f74ef
 
6f74ef
 PROGS+=(
6f74ef
 mkofboot
6f74ef
 ofpath
6f74ef
 ybin
6f74ef
 yabootconfig
6f74ef
-bootlist
6f74ef
 pseries_platform
6f74ef
 nvram
6f74ef
-ofpathname
6f74ef
 bc
6f74ef
 agetty
6f74ef
 )
6f74ef
 
6f74ef
+if grep -q "emulated by qemu" /proc/cpuinfo ; then
6f74ef
+    # Qemu/KVM virtual machines don't need bootlist - don't complain if
6f74ef
+    # it is missing
6f74ef
+    PROGS+=( bootlist )
6f74ef
+else
6f74ef
+    # PowerVM environment, we need to run bootlist, otherwise
6f74ef
+    # we can't make the system bpotable. Be strict about requiring it
6f74ef
+    REQUIRED_PROGS+=( bootlist )
6f74ef
+fi
6f74ef
+
6f74ef
 COPY_AS_IS+=(
6f74ef
 /usr/lib/yaboot/yaboot
6f74ef
 /usr/lib/yaboot/ofboot
6f74ef
diff --git a/usr/share/rear/conf/Linux-ppc64le.conf b/usr/share/rear/conf/Linux-ppc64le.conf
6f74ef
index d00154a2..df8066ea 100644
6f74ef
--- a/usr/share/rear/conf/Linux-ppc64le.conf
6f74ef
+++ b/usr/share/rear/conf/Linux-ppc64le.conf
6f74ef
@@ -1,10 +1,8 @@
6f74ef
 REQUIRED_PROGS+=( sfdisk )
6f74ef
 
6f74ef
 PROGS+=(
6f74ef
-bootlist
6f74ef
 pseries_platform
6f74ef
 nvram
6f74ef
-ofpathname
6f74ef
 bc
6f74ef
 agetty
6f74ef
 )
6f74ef
@@ -17,4 +15,18 @@ agetty
6f74ef
 if [[ $(awk '/platform/ {print $NF}' < /proc/cpuinfo) != PowerNV ]] ; then
6f74ef
     # No firmware files when ppc64le Linux is not run in BareMetal Mode (PowerNV):
6f74ef
     test "${FIRMWARE_FILES[*]}" || FIRMWARE_FILES=( 'no' )
6f74ef
+    # grub2-install for powerpc-ieee1275 calls ofpathname, so without it,
6f74ef
+    # the rescue system can't make the recovered system bootable
6f74ef
+    REQUIRED_PROGS+=( ofpathname )
6f74ef
+    if grep -q "emulated by qemu" /proc/cpuinfo ; then
6f74ef
+        # Qemu/KVM virtual machines don't need bootlist - don't complain if
6f74ef
+        # it is missing
6f74ef
+        PROGS+=( bootlist )
6f74ef
+    else
6f74ef
+        # PowerVM environment, we need to run bootlist, otherwise
6f74ef
+        # we can't make the system bpotable. Be strict about requiring it
6f74ef
+        REQUIRED_PROGS+=( bootlist )
6f74ef
+    fi
6f74ef
+else
6f74ef
+    PROGS+=( ofpathname bootlist )
6f74ef
 fi