Blame 0158-iscsi-iscsiroot.sh-put-variables-in-quotes.patch

Harald Hoyer bb31e7
From 98e9db275596577b649caa73f8580429f3abb8f4 Mon Sep 17 00:00:00 2001
Harald Hoyer bb31e7
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer bb31e7
Date: Fri, 13 Nov 2015 13:15:05 +0100
Harald Hoyer bb31e7
Subject: [PATCH] iscsi/iscsiroot.sh: put variables in quotes
Harald Hoyer bb31e7
Harald Hoyer bb31e7
best practice
Harald Hoyer bb31e7
---
Harald Hoyer bb31e7
 modules.d/95iscsi/iscsiroot.sh | 48 +++++++++++++++++++++---------------------
Harald Hoyer bb31e7
 1 file changed, 24 insertions(+), 24 deletions(-)
Harald Hoyer bb31e7
Harald Hoyer bb31e7
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
Harald Hoyer bb31e7
index 5752cce..8a98881 100755
Harald Hoyer bb31e7
--- a/modules.d/95iscsi/iscsiroot.sh
Harald Hoyer bb31e7
+++ b/modules.d/95iscsi/iscsiroot.sh
Harald Hoyer bb31e7
@@ -109,7 +109,7 @@ handle_netroot()
Harald Hoyer bb31e7
     getarg rw && iscsirw=rw
Harald Hoyer bb31e7
     fsopts=${fsopts:+$fsopts,}${iscsirw}
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
-    if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then
Harald Hoyer bb31e7
+    if [ -z "$iscsi_initiator" ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then
Harald Hoyer bb31e7
            iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
Harald Hoyer bb31e7
            echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
Harald Hoyer bb31e7
            rm -f /etc/iscsi/initiatorname.iscsi
Harald Hoyer bb31e7
@@ -120,14 +120,14 @@ handle_netroot()
Harald Hoyer bb31e7
            > /tmp/iscsi_set_initiator
Harald Hoyer bb31e7
     fi
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
-    if [ -z $iscsi_initiator ]; then
Harald Hoyer bb31e7
+    if [ -z "$iscsi_initiator" ]; then
Harald Hoyer bb31e7
         [ -f /run/initiatorname.iscsi ] && . /run/initiatorname.iscsi
Harald Hoyer bb31e7
         [ -f /etc/initiatorname.iscsi ] && . /etc/initiatorname.iscsi
Harald Hoyer bb31e7
         [ -f /etc/iscsi/initiatorname.iscsi ] && . /etc/iscsi/initiatorname.iscsi
Harald Hoyer bb31e7
         iscsi_initiator=$InitiatorName
Harald Hoyer bb31e7
     fi
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
-    if [ -z $iscsi_initiator ]; then
Harald Hoyer bb31e7
+    if [ -z "$iscsi_initiator" ]; then
Harald Hoyer bb31e7
         iscsi_initiator=$(iscsi-iname)
Harald Hoyer bb31e7
         echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
Harald Hoyer bb31e7
         rm -f /etc/iscsi/initiatorname.iscsi
Harald Hoyer bb31e7
@@ -140,15 +140,15 @@ handle_netroot()
Harald Hoyer bb31e7
     fi
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
-    if [ -z $iscsi_target_port ]; then
Harald Hoyer bb31e7
+    if [ -z "$iscsi_target_port" ]; then
Harald Hoyer bb31e7
         iscsi_target_port=3260
Harald Hoyer bb31e7
     fi
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
-    if [ -z $iscsi_target_group ]; then
Harald Hoyer bb31e7
+    if [ -z "$iscsi_target_group" ]; then
Harald Hoyer bb31e7
         iscsi_target_group=1
Harald Hoyer bb31e7
     fi
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
-    if [ -z $iscsi_lun ]; then
Harald Hoyer bb31e7
+    if [ -z "$iscsi_lun" ]; then
Harald Hoyer bb31e7
         iscsi_lun=0
Harald Hoyer bb31e7
     fi
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
@@ -182,15 +182,15 @@ handle_netroot()
Harald Hoyer bb31e7
                             --description="Login iSCSI Target $iscsi_target_name" \
Harald Hoyer bb31e7
                             --unit="$netroot_enc" -- \
Harald Hoyer bb31e7
                             $(command -v iscsistart) \
Harald Hoyer bb31e7
-                            -i $iscsi_initiator -t $iscsi_target_name        \
Harald Hoyer bb31e7
-                            -g $iscsi_target_group -a $iscsi_target_ip      \
Harald Hoyer bb31e7
-                            -p $iscsi_target_port \
Harald Hoyer bb31e7
-                            ${iscsi_username:+-u $iscsi_username} \
Harald Hoyer bb31e7
-                            ${iscsi_password:+-w $iscsi_password} \
Harald Hoyer bb31e7
-                            ${iscsi_in_username:+-U $iscsi_in_username} \
Harald Hoyer bb31e7
-                            ${iscsi_in_password:+-W $iscsi_in_password} \
Harald Hoyer bb31e7
-	                    ${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \
Harald Hoyer bb31e7
-	                    ${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \
Harald Hoyer bb31e7
+                            -i "$iscsi_initiator" -t "$iscsi_target_name"        \
Harald Hoyer bb31e7
+                            -g "$iscsi_target_group" -a "$iscsi_target_ip"      \
Harald Hoyer bb31e7
+                            -p "$iscsi_target_port" \
Harald Hoyer bb31e7
+                            ${iscsi_username:+-u "$iscsi_username"} \
Harald Hoyer bb31e7
+                            ${iscsi_password:+-w "$iscsi_password"} \
Harald Hoyer bb31e7
+                            ${iscsi_in_username:+-U "$iscsi_in_username"} \
Harald Hoyer bb31e7
+                            ${iscsi_in_password:+-W "$iscsi_in_password"} \
Harald Hoyer bb31e7
+	                    ${iscsi_iface_name:+--param "iface.iscsi_ifacename=$iscsi_iface_name"} \
Harald Hoyer bb31e7
+	                    ${iscsi_netdev_name:+--param "iface.net_ifacename=$iscsi_netdev_name"} \
Harald Hoyer bb31e7
                             ${iscsi_param} >/dev/null 2>&1 \
Harald Hoyer bb31e7
 	            && { > $hookdir/initqueue/work ; }
Harald Hoyer bb31e7
             else
Harald Hoyer bb31e7
@@ -199,15 +199,15 @@ handle_netroot()
Harald Hoyer bb31e7
             fi
Harald Hoyer bb31e7
         fi
Harald Hoyer bb31e7
     else
Harald Hoyer bb31e7
-        iscsistart -i $iscsi_initiator -t $iscsi_target_name        \
Harald Hoyer bb31e7
-                   -g $iscsi_target_group -a $iscsi_target_ip      \
Harald Hoyer bb31e7
-                   -p $iscsi_target_port \
Harald Hoyer bb31e7
-                   ${iscsi_username:+-u $iscsi_username} \
Harald Hoyer bb31e7
-                   ${iscsi_password:+-w $iscsi_password} \
Harald Hoyer bb31e7
-                   ${iscsi_in_username:+-U $iscsi_in_username} \
Harald Hoyer bb31e7
-                   ${iscsi_in_password:+-W $iscsi_in_password} \
Harald Hoyer bb31e7
-	           ${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \
Harald Hoyer bb31e7
-	           ${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \
Harald Hoyer bb31e7
+        iscsistart -i "$iscsi_initiator" -t "$iscsi_target_name"        \
Harald Hoyer bb31e7
+                   -g "$iscsi_target_group" -a "$iscsi_target_ip"      \
Harald Hoyer bb31e7
+                   -p "$iscsi_target_port" \
Harald Hoyer bb31e7
+                   ${iscsi_username:+-u "$iscsi_username"} \
Harald Hoyer bb31e7
+                   ${iscsi_password:+-w "$iscsi_password"} \
Harald Hoyer bb31e7
+                   ${iscsi_in_username:+-U "$iscsi_in_username"} \
Harald Hoyer bb31e7
+                   ${iscsi_in_password:+-W "$iscsi_in_password"} \
Harald Hoyer bb31e7
+	           ${iscsi_iface_name:+--param "iface.iscsi_ifacename=$iscsi_iface_name"} \
Harald Hoyer bb31e7
+	           ${iscsi_netdev_name:+--param "iface.net_ifacename=$iscsi_netdev_name"} \
Harald Hoyer bb31e7
                    ${iscsi_param} \
Harald Hoyer bb31e7
 	    && { > $hookdir/initqueue/work ; }
Harald Hoyer bb31e7
     fi