]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
iscsiroot: there's never more than one target per call
authorMartin Wilck <mwilck@suse.com>
Thu, 4 Apr 2019 13:40:14 +0000 (15:40 +0200)
committerHarald Hoyer <harald@hoyer.xyz>
Fri, 25 Oct 2019 07:18:12 +0000 (09:18 +0200)
iscsi_target_name is set by iscsi_root, and thus can't have
more than one member. This allows us to get rid of one bashism
in iscsiroot.sh.

modules.d/95iscsi/iscsiroot.sh

index 45db89c1d5a2db0bb12c92eb19d8e5ba240ec684..a334b76ea36f9c502218d2f64e6d3cb6b53ae046 100755 (executable)
@@ -213,10 +213,8 @@ handle_netroot()
     targets=$(iscsiadm -m discovery -t st -p $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} | sed 's/^.*iqn/iqn/')
     [ -z "$targets" ] && echo "Target discovery to $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} failed with status $?" && exit 1
 
-    for target in $iscsi_target_name; do
-        case "$targets" in
-        *$target*)
-            EXTRA=""
+    for target in $targets; do
+        if [ "$target" = "$iscsi_target_name" ]; then
             if [ -n "$iscsi_iface_name" ]; then
                 iscsiadm -m iface -I $iscsi_iface_name --op=new
                 EXTRA=" ${iscsi_netdev_name:+--name=iface.net_ifacename --value=$iscsi_netdev_name} "
@@ -239,10 +237,7 @@ handle_netroot()
             if [ "$netif" != "timeout" ]; then
                 $CMD --login
             fi
-        ;;
-        *)
-        ;;
-        esac
+        fi
     done
 
     if [ "$netif" = "timeout" ]; then