]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
95iscsi: use ip_params_for_remote_addr()
authorMartin Wilck <mwilck@suse.com>
Fri, 10 Jul 2020 16:09:05 +0000 (18:09 +0200)
committerDaniel Molkentin <daniel@molkentin.de>
Tue, 4 Aug 2020 06:43:32 +0000 (08:43 +0200)
Use the new helper function.

modules.d/95iscsi/module-setup.sh

index 8b6300d58c1131d17f410946674f200af135380d..dfacd7979a647bbf17ac6c9a5a91813f3c5461e6 100755 (executable)
@@ -120,27 +120,7 @@ install_iscsiroot() {
     done
 
     [ -z "$iscsi_address" ] && return
-    local_address=$(ip -o route get to $iscsi_address | sed -n 's/.*src \([0-9a-f.:]*\).*/\1/p')
-    ifname=$(ip -o route get to $iscsi_address | sed -n 's/.*dev \([^ ]*\).*/\1/p')
-
-    # follow ifcfg settings for boot protocol
-    for _path in \
-        "/etc/sysconfig/network-scripts/ifcfg-$ifname" \
-        "/etc/sysconfig/network/ifcfg-$ifname" \
-    ; do
-        [ -f "$_path" ] && bootproto=$(sed -n "s/BOOTPROTO='\?\([[:alpha:]]*6\?\)4\?/\1/p" "$_path")
-    done
-
-    if [ $bootproto ]; then
-        printf 'ip=%s:%s ' ${ifname} ${bootproto}
-    else
-        printf 'ip=%s:static ' ${ifname}
-    fi
-
-    if [ -e /sys/class/net/$ifname/address ] ; then
-        ifmac=$(cat /sys/class/net/$ifname/address)
-        printf 'ifname=%s:%s ' ${ifname} ${ifmac}
-    fi
+    ip_params_for_remote_addr "$iscsi_address"
 
     if [ -n "$iscsi_address" -a -n "$iscsi_targetname" ] ; then
         if [ -n "$iscsi_port" -a "$iscsi_port" -eq 3260 ] ; then