Blame SOURCES/0361-iscsi-iscsiroot.sh-better-put-variables-in-quotes.patch

a0a3b4
From 2f20797a40104bfa133e7e5bfcf2d916b34413e5 Mon Sep 17 00:00:00 2001
a0a3b4
From: Harald Hoyer <harald@redhat.com>
a0a3b4
Date: Thu, 12 Nov 2015 11:42:13 +0100
a0a3b4
Subject: [PATCH] iscsi/iscsiroot.sh: better put variables in quotes
a0a3b4
a0a3b4
first rule for a bash programmer
a0a3b4
---
a0a3b4
 modules.d/95iscsi/iscsiroot.sh | 62 +++++++++++++++++++++---------------------
a0a3b4
 1 file changed, 31 insertions(+), 31 deletions(-)
a0a3b4
a0a3b4
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
a0a3b4
index ea1bead..ce8f547 100755
a0a3b4
--- a/modules.d/95iscsi/iscsiroot.sh
a0a3b4
+++ b/modules.d/95iscsi/iscsiroot.sh
a0a3b4
@@ -78,23 +78,23 @@ handle_netroot()
a0a3b4
 
a0a3b4
     # override conf settings by command line options
a0a3b4
     arg=$(getargs rd.iscsi.initiator -d iscsi_initiator=)
a0a3b4
-    [ -n "$arg" ] && iscsi_initiator=$arg
a0a3b4
+    [ -n "$arg" ] && iscsi_initiator="$arg"
a0a3b4
     arg=$(getargs rd.iscsi.target.name -d iscsi_target_name=)
a0a3b4
-    [ -n "$arg" ] && iscsi_target_name=$arg
a0a3b4
+    [ -n "$arg" ] && iscsi_target_name="$arg"
a0a3b4
     arg=$(getargs rd.iscsi.target.ip -d iscsi_target_ip)
a0a3b4
-    [ -n "$arg" ] && iscsi_target_ip=$arg
a0a3b4
+    [ -n "$arg" ] && iscsi_target_ip="$arg"
a0a3b4
     arg=$(getargs rd.iscsi.target.port -d iscsi_target_port=)
a0a3b4
-    [ -n "$arg" ] && iscsi_target_port=$arg
a0a3b4
+    [ -n "$arg" ] && iscsi_target_port="$arg"
a0a3b4
     arg=$(getargs rd.iscsi.target.group -d iscsi_target_group=)
a0a3b4
-    [ -n "$arg" ] && iscsi_target_group=$arg
a0a3b4
+    [ -n "$arg" ] && iscsi_target_group="$arg"
a0a3b4
     arg=$(getargs rd.iscsi.username -d iscsi_username=)
a0a3b4
-    [ -n "$arg" ] && iscsi_username=$arg
a0a3b4
+    [ -n "$arg" ] && iscsi_username="$arg"
a0a3b4
     arg=$(getargs rd.iscsi.password -d iscsi_password)
a0a3b4
-    [ -n "$arg" ] && iscsi_password=$arg
a0a3b4
+    [ -n "$arg" ] && iscsi_password="$arg"
a0a3b4
     arg=$(getargs rd.iscsi.in.username -d iscsi_in_username=)
a0a3b4
-    [ -n "$arg" ] && iscsi_in_username=$arg
a0a3b4
+    [ -n "$arg" ] && iscsi_in_username="$arg"
a0a3b4
     arg=$(getargs rd.iscsi.in.password -d iscsi_in_password=)
a0a3b4
-    [ -n "$arg" ] && iscsi_in_password=$arg
a0a3b4
+    [ -n "$arg" ] && iscsi_in_password="$arg"
a0a3b4
     for p in $(getargs rd.iscsi.param -d iscsi_param); do
a0a3b4
 	iscsi_param="$iscsi_param --param $p"
a0a3b4
     done
a0a3b4
@@ -109,9 +109,9 @@ handle_netroot()
a0a3b4
 # XXX is this needed?
a0a3b4
     getarg ro && iscsirw=ro
a0a3b4
     getarg rw && iscsirw=rw
a0a3b4
-    fsopts=${fsopts:+$fsopts,}${iscsirw}
a0a3b4
+    fsopts="${fsopts:+$fsopts,}${iscsirw}"
a0a3b4
 
a0a3b4
-    if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then
a0a3b4
+    if [ -z "$iscsi_initiator" ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then
a0a3b4
            iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
a0a3b4
            echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
a0a3b4
            rm -f /etc/iscsi/initiatorname.iscsi
a0a3b4
@@ -122,14 +122,14 @@ handle_netroot()
a0a3b4
            > /tmp/iscsi_set_initiator
a0a3b4
     fi
a0a3b4
 
a0a3b4
-    if [ -z $iscsi_initiator ]; then
a0a3b4
+    if [ -z "$iscsi_initiator" ]; then
a0a3b4
         [ -f /run/initiatorname.iscsi ] && . /run/initiatorname.iscsi
a0a3b4
         [ -f /etc/initiatorname.iscsi ] && . /etc/initiatorname.iscsi
a0a3b4
         [ -f /etc/iscsi/initiatorname.iscsi ] && . /etc/iscsi/initiatorname.iscsi
a0a3b4
         iscsi_initiator=$InitiatorName
a0a3b4
     fi
a0a3b4
 
a0a3b4
-    if [ -z $iscsi_initiator ]; then
a0a3b4
+    if [ -z "$iscsi_initiator" ]; then
a0a3b4
         iscsi_initiator=$(iscsi-iname)
a0a3b4
         echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
a0a3b4
         rm -f /etc/iscsi/initiatorname.iscsi
a0a3b4
@@ -184,15 +184,15 @@ handle_netroot()
a0a3b4
                             --description="Login iSCSI Target $iscsi_target_name" \
a0a3b4
                             --unit="$netroot_enc" -- \
a0a3b4
                             $(command -v iscsistart) \
a0a3b4
-                            -i $iscsi_initiator -t $iscsi_target_name        \
a0a3b4
-                            -g $iscsi_target_group -a $iscsi_target_ip      \
a0a3b4
-                            -p $iscsi_target_port \
a0a3b4
-                            ${iscsi_username:+-u $iscsi_username} \
a0a3b4
-                            ${iscsi_password:+-w $iscsi_password} \
a0a3b4
-                            ${iscsi_in_username:+-U $iscsi_in_username} \
a0a3b4
-                            ${iscsi_in_password:+-W $iscsi_in_password} \
a0a3b4
-	                    ${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \
a0a3b4
-	                    ${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \
a0a3b4
+                            -i "$iscsi_initiator" -t "$iscsi_target_name"        \
a0a3b4
+                            -g "$iscsi_target_group" -a "$iscsi_target_ip"      \
a0a3b4
+                            -p "$iscsi_target_port" \
a0a3b4
+                            ${iscsi_username:+-u "$iscsi_username"} \
a0a3b4
+                            ${iscsi_password:+-w "$iscsi_password"} \
a0a3b4
+                            ${iscsi_in_username:+-U "$iscsi_in_username"} \
a0a3b4
+                            ${iscsi_in_password:+-W "$iscsi_in_password"} \
a0a3b4
+	                    ${iscsi_iface_name:+--param "iface.iscsi_ifacename=$iscsi_iface_name"} \
a0a3b4
+	                    ${iscsi_netdev_name:+--param "iface.net_ifacename=$iscsi_netdev_name"} \
a0a3b4
                             ${iscsi_param} >/dev/null 2>&1 \
a0a3b4
 	            && { > $hookdir/initqueue/work ; }
a0a3b4
             else
a0a3b4
@@ -201,15 +201,15 @@ handle_netroot()
a0a3b4
             fi
a0a3b4
         fi
a0a3b4
     else
a0a3b4
-        iscsistart -i $iscsi_initiator -t $iscsi_target_name        \
a0a3b4
-                   -g $iscsi_target_group -a $iscsi_target_ip      \
a0a3b4
-                   -p $iscsi_target_port \
a0a3b4
-                   ${iscsi_username:+-u $iscsi_username} \
a0a3b4
-                   ${iscsi_password:+-w $iscsi_password} \
a0a3b4
-                   ${iscsi_in_username:+-U $iscsi_in_username} \
a0a3b4
-                   ${iscsi_in_password:+-W $iscsi_in_password} \
a0a3b4
-	           ${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \
a0a3b4
-	           ${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \
a0a3b4
+        iscsistart -i "$iscsi_initiator" -t "$iscsi_target_name"        \
a0a3b4
+                   -g "$iscsi_target_group" -a "$iscsi_target_ip"      \
a0a3b4
+                   -p "$iscsi_target_port" \
a0a3b4
+                   ${iscsi_username:+-u "$iscsi_username"} \
a0a3b4
+                   ${iscsi_password:+-w "$iscsi_password"} \
a0a3b4
+                   ${iscsi_in_username:+-U "$iscsi_in_username"} \
a0a3b4
+                   ${iscsi_in_password:+-W "$iscsi_in_password"} \
a0a3b4
+	           ${iscsi_iface_name:+--param "iface.iscsi_ifacename=$iscsi_iface_name"} \
a0a3b4
+	           ${iscsi_netdev_name:+--param "iface.net_ifacename=$iscsi_netdev_name"} \
a0a3b4
                    ${iscsi_param} \
a0a3b4
 	    && { > $hookdir/initqueue/work ; }
a0a3b4
     fi