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