File 0632-95nfs-look-in-nfs-mount-options-for-nfs-server-ip-bs.patch of Package dracut.28355

From 326ee0eee2db0a45de88aa3f6a77fc8f868ed152 Mon Sep 17 00:00:00 2001
From: Thomas Blume <Thomas.Blume@suse.com>
Date: Mon, 29 Jun 2020 18:26:44 +0200
Subject: [PATCH] 95nfs: look in nfs mount options for nfs server ip
 (bsc#1003872)

---
 modules.d/95nfs/module-setup.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
index dce457f4..c0c41512 100755
--- a/modules.d/95nfs/module-setup.sh
+++ b/modules.d/95nfs/module-setup.sh
@@ -50,11 +50,14 @@ cmdline() {
     echo "$nfs_root"
 
     ### ip= ###
-    if [[ $nfs_device = [0-9]*\.[0-9]*\.[0-9]*.[0-9]* ]] || [[ $nfs_device = \[.*\] ]]; then
+    if [[ $nfs_device = [0-9]*\.[0-9]*\.[0-9]*\.[0-9]* ]] || [[ $nfs_device = \[*:*:*\] ]]; then
         nfs_address="${nfs_device%%:*}"
     else
-        lookup=$(host "${nfs_device%%:*}"| grep " address " | head -n1)
-        nfs_address=${lookup##* }
+        nfs_address=${nfs_options##*addr=}
+        if [[ "$nfs_address" != [0-9]*\.[0-9]*\.[0-9]*\.[0-9]* ]] && ! strglobin "$nfs_address" '*:*:*'; then
+            lookup=$(host "${nfs_device%%:*}"| grep " address " | head -n1)
+            nfs_address=${lookup##* }
+        fi
     fi
     ifname=$(ip -o route get to $nfs_address | sed -n 's/.*dev \([^ ]*\).*/\1/p')
     if [ -d /sys/class/net/$ifname/bonding ]; then
-- 
2.26.2

openSUSE Build Service is sponsored by