Blob Blame History Raw
From f34a2ef14df05affa3347d7191ff324bcb547e79 Mon Sep 17 00:00:00 2001
From: Thomas Renninger <trenn@suse.de>
Date: Thu, 11 Dec 2014 15:46:04 +0100
Subject: [PATCH] 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 7351427..5bfb017 100755
--- a/modules.d/95iscsi/iscsiroot.sh
+++ b/modules.d/95iscsi/iscsiroot.sh
@@ -81,23 +81,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 cd6cb4b..9975e59 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -123,7 +123,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
 }