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