Blame 0037-95iscsi-iscsiroot.sh-fix-for-empty-root.patch

Harald Hoyer ee76a0
From f8208d682fad279bebb2019c5df57f8d42b133c6 Mon Sep 17 00:00:00 2001
Harald Hoyer ee76a0
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer ee76a0
Date: Thu, 8 Mar 2012 12:26:00 +0100
Harald Hoyer ee76a0
Subject: [PATCH] 95iscsi/iscsiroot.sh: fix for empty $root
Harald Hoyer ee76a0
Harald Hoyer ee76a0
---
Harald Hoyer ee76a0
 modules.d/95iscsi/iscsiroot.sh |   15 ++++++---------
Harald Hoyer 9e9f8f
 1 file changed, 6 insertions(+), 9 deletions(-)
Harald Hoyer ee76a0
Harald Hoyer ee76a0
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
Harald Hoyer ee76a0
index 1bd6dd3..7fa2715 100755
Harald Hoyer ee76a0
--- a/modules.d/95iscsi/iscsiroot.sh
Harald Hoyer ee76a0
+++ b/modules.d/95iscsi/iscsiroot.sh
Harald Hoyer ee76a0
@@ -40,7 +40,7 @@ modprobe crc32c 2>/dev/null
Harald Hoyer ee76a0
 [ -e /sys/module/bnx2i ] && iscsiuio
Harald Hoyer ee76a0
 
Harald Hoyer ee76a0
 if getargbool 0 rd.iscsi.firmware -y iscsi_firmware ; then
Harald Hoyer ee76a0
-    if [ -n "${root%%block:*}" ]; then
Harald Hoyer ee76a0
+    if [ -z "$root" -o -n "${root%%block:*}" ]; then
Harald Hoyer ee76a0
         # if root is not specified try to mount the whole iSCSI LUN
Harald Hoyer ee76a0
         printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules
Harald Hoyer ee76a0
         udevadm control --reload
Harald Hoyer ee76a0
@@ -167,9 +167,12 @@ handle_netroot()
Harald Hoyer ee76a0
 
Harald Hoyer ee76a0
 # FIXME $iscsi_protocol??
Harald Hoyer ee76a0
 
Harald Hoyer ee76a0
-    if [ -n "${root%%block:*}" ]; then
Harald Hoyer ee76a0
-    # if root is not specified try to mount the whole iSCSI LUN
Harald Hoyer ee76a0
+    if [ -z "$root" -o -n "${root%%block:*}" ]; then
Harald Hoyer ee76a0
+        # if root is not specified try to mount the whole iSCSI LUN
Harald Hoyer ee76a0
         printf 'SYMLINK=="disk/by-path/*-iscsi-*-%s", SYMLINK+="root"\n' $iscsi_lun >> /etc/udev/rules.d/99-iscsi-root.rules
Harald Hoyer ee76a0
+
Harald Hoyer ee76a0
+        # install mount script
Harald Hoyer ee76a0
+        echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh
Harald Hoyer ee76a0
     fi
Harald Hoyer ee76a0
 
Harald Hoyer ee76a0
     # inject new exit_if_exists
Harald Hoyer ee76a0
@@ -185,12 +188,6 @@ handle_netroot()
Harald Hoyer ee76a0
         ${iscsi_password+-w $iscsi_password} \
Harald Hoyer ee76a0
         ${iscsi_in_username+-U $iscsi_in_username} \
Harald Hoyer ee76a0
         ${iscsi_in_password+-W $iscsi_in_password} || :
Harald Hoyer ee76a0
-
Harald Hoyer ee76a0
-# install mount script
Harald Hoyer ee76a0
-    if [ -n "${root%%block:*}" ]; then
Harald Hoyer ee76a0
-    # if root is not specified try to mount the whole iSCSI LUN
Harald Hoyer ee76a0
-        echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh
Harald Hoyer ee76a0
-    fi
Harald Hoyer ee76a0
 }
Harald Hoyer ee76a0
 
Harald Hoyer ee76a0
 # loop over all netroot parameter