File 0624-Dracut-handle-not-having-a-boot-target.patch of Package dracut

From 57d94601836cab416ae7892d4bbe868a55d43aea Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Mon, 25 Mar 2019 17:03:52 -0700
Subject: [PATCH] Dracut: handle not having a boot target

Code to detect the sysfs attribute "is_boot_target" was
failing in the case there was no such attribute, with
"is_boot" being set to some error message, rather than
the boolean "0" or "1" expected, causing calls to dracut
to rebuild the initramfs spew error messages when
detecting an iscsi root.
---
 modules.d/95iscsi/module-setup.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index d968c9b9..fdca5e27 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -86,8 +86,13 @@ install_iscsiroot() {
     iscsi_host=${host##*/}
 
     for flash in ${host}/flashnode_sess-* ; do
-        is_boot=$(cat $flash/is_boot_target)
-        if [ $is_boot -eq 1 ] ; then
+	is_boot="0"
+	if [[ -d "$flash" ]]; then
+	    if [[ -r "$flash/is_boot_target" ]]; then
+		is_boot=$(cat $flash/is_boot_target)
+	    fi
+	fi
+        if [[ "$is_boot" -eq 1 ]]; then
             # qla4xxx flashnode session; skip iBFT discovery
             iscsi_initiator=$(cat /sys/class/iscsi_host/${iscsi_host}/initiatorname)
             echo "rd.iscsi.initiator=${iscsi_initiator}"
-- 
2.26.1

openSUSE Build Service is sponsored by