File 0105-95iscsi-parse-output-from-iscsiadm-correctly.patch of Package dracut.244

From a852317e8338ffb94fa1ac9512d465ac8c72cdc0 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 8 Jul 2014 13:16:41 +0200
Subject: 95iscsi: parse output from iscsiadm correctly

Due to some obsure reason the IFS parameter is not set correctly
when evaluating get_ibft_mod(). So change the parsing to not rely
on IFS altogether.

References: bnc#886199

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 modules.d/95iscsi/module-setup.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index 81ffb18..f63634a 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -3,15 +3,15 @@
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 
 get_ibft_mod() {
-    local ibft_mac=$1 IFS
+    local ibft_mac=$1
+    local iface_mac iface_mod
     # Return the iSCSI offload module for a given MAC address
-    iscsiadm -m iface | while read iface_name iface_desc ; do
-        OLDIFS="$IFS"
-        IFS=$','
-        set -- $iface_desc
-        IFS="$OLDIFS"
-        if [ "$ibft_mac" = "$2" ] ; then
-            echo $1
+    for iface_desc in $(iscsiadm -m iface | cut -f 2 -d ' '); do
+        iface_mod=${iface_desc%%,*}
+        iface_mac=${iface_desc#*,}
+        iface_mac=${iface_mac%%,*}
+        if [ "$ibft_mac" = "$iface_mac" ] ; then
+            echo $iface_mod
             return 0
         fi
         
-- 
1.8.4.5

openSUSE Build Service is sponsored by