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

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

index d9a91fdff1cdf9664ed4eb4c8a0fb2ebbeee3be9..4a8e140b391b44e27863a467d56a9c3993011480 100755 (executable)
@@ -47,7 +47,6 @@ cmdline() {
     local nfs_root
     local nfs_address
     local lookup
-    local ifname
 
     ### nfsroot= ###
     nfs_device=$(findmnt -t nfs4 -n -o SOURCE /)
@@ -69,21 +68,9 @@ cmdline() {
         lookup=$(host "${nfs_device%%:*}"| grep " address " | head -n1)
         nfs_address=${lookup##* }
     fi
-    ifname=$(ip -o route get to $nfs_address | sed -n 's/.*dev \([^ ]*\).*/\1/p')
-    if [ -d /sys/class/net/$ifname/bonding ]; then
-        dinfo "Found bonded interface '${ifname}'. Make sure to provide an appropriate 'bond=' cmdline."
-        return
-    elif [ -e /sys/class/net/$ifname/address ] ; then
-        ifmac=$(cat /sys/class/net/$ifname/address)
-        printf 'ifname=%s:%s ' ${ifname} ${ifmac}
-    fi
 
-    bootproto=$(sed -n "/BOOTPROTO/s/BOOTPROTO='\([[:alpha:]]*6\?\)4\?'/\1/p" /etc/sysconfig/network/ifcfg-$ifname)
-    if [ $bootproto ]; then
-        printf 'ip=%s:%s ' ${ifname} ${bootproto}
-    else
-        printf 'ip=%s:static ' ${ifname}
-    fi
+    [[ $nfs_address ]] || return
+    ip_params_for_remote_addr "$nfs_address"
 }
 
 # called by dracut