File 0155-iscsi-iscsi.initiator-and-others-can-and-must-only-s.patch of Package dracut.892

From 26a858af5977a41b21839ce8411024bfe3f63dea Mon Sep 17 00:00:00 2001
From: Thomas Renninger <trenn@suse.de>
Date: Thu, 4 Sep 2014 13:36:18 +0200
Subject: iscsi: iscsi.initiator and others can and must only show up once

Make sure duplicates of iscsi.initiator vanish.
Only get one rd.iscsi.* paramter value. If getargs is used and several
parameters are parsed, one gets two values separated by whitespace in a
variable which breaks later code and is not suppported.

Signed-off-by: Thomas Renninger <trenn@suse.de>
---
 modules.d/95iscsi/iscsiroot.sh    |   18 +++++++++---------
 modules.d/95iscsi/module-setup.sh |    5 ++++-
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
index 1de6fb7..1c4be4e 100755
--- a/modules.d/95iscsi/iscsiroot.sh
+++ b/modules.d/95iscsi/iscsiroot.sh
@@ -83,23 +83,23 @@ handle_netroot()
     local p
 
     # override conf settings by command line options
-    arg=$(getargs rd.iscsi.initiator -d iscsi_initiator=)
+    arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=)
     [ -n "$arg" ] && iscsi_initiator=$arg
-    arg=$(getargs rd.iscsi.target.name -d iscsi_target_name=)
+    arg=$(getarg rd.iscsi.target.name -d iscsi_target_name=)
     [ -n "$arg" ] && iscsi_target_name=$arg
-    arg=$(getargs rd.iscsi.target.ip -d iscsi_target_ip)
+    arg=$(getarg rd.iscsi.target.ip -d iscsi_target_ip)
     [ -n "$arg" ] && iscsi_target_ip=$arg
-    arg=$(getargs rd.iscsi.target.port -d iscsi_target_port=)
+    arg=$(getarg rd.iscsi.target.port -d iscsi_target_port=)
     [ -n "$arg" ] && iscsi_target_port=$arg
-    arg=$(getargs rd.iscsi.target.group -d iscsi_target_group=)
+    arg=$(getarg rd.iscsi.target.group -d iscsi_target_group=)
     [ -n "$arg" ] && iscsi_target_group=$arg
-    arg=$(getargs rd.iscsi.username -d iscsi_username=)
+    arg=$(getarg rd.iscsi.username -d iscsi_username=)
     [ -n "$arg" ] && iscsi_username=$arg
-    arg=$(getargs rd.iscsi.password -d iscsi_password)
+    arg=$(getarg rd.iscsi.password -d iscsi_password)
     [ -n "$arg" ] && iscsi_password=$arg
-    arg=$(getargs rd.iscsi.in.username -d iscsi_in_username=)
+    arg=$(getarg rd.iscsi.in.username -d iscsi_in_username=)
     [ -n "$arg" ] && iscsi_in_username=$arg
-    arg=$(getargs rd.iscsi.in.password -d iscsi_in_password=)
+    arg=$(getarg rd.iscsi.in.password -d iscsi_in_password=)
     [ -n "$arg" ] && iscsi_in_password=$arg
     for p in $(getargs rd.iscsi.param -d iscsi_param); do
 	iscsi_param="$iscsi_param --param $p"
diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index 9772210..4784ea3 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -99,7 +99,10 @@ install_iscsiroot() {
                 iscsi_address="[$iscsi_address]"
                 ;;
         esac
-        echo "rd.iscsi.initiator=${iscsi_initiator} netroot=iscsi:${iscsi_address}::${iscsi_port}:${iscsi_lun}:${iscsi_targetname}"
+        # Must be two separate lines, so that "sort | uniq" commands later
+        # can sort out rd.iscsi.initiator= duplicates
+        echo "rd.iscsi.initiator=${iscsi_initiator}"
+        echo "netroot=iscsi:${iscsi_address}::${iscsi_port}:${iscsi_lun}:${iscsi_targetname}"
     fi
     return 0
 }
-- 
1.7.6.1