Harald Hoyer 3610a1
From 84912dde41a93f665a5fd1e43f0c5796d432d751 Mon Sep 17 00:00:00 2001
Harald Hoyer 3610a1
From: Harald Hoyer <harald@hoyer.xyz>
Harald Hoyer 3610a1
Date: Mon, 18 Dec 2017 09:13:29 +0100
Harald Hoyer 3610a1
Subject: [PATCH] Merge pull request #327 from danimo/nfs_host_robustness
Harald Hoyer 3610a1
Harald Hoyer 3610a1
Rebustness fixes for NFS hostnames
Harald Hoyer 3610a1
---
Harald Hoyer 3610a1
 modules.d/95nfs/module-setup.sh | 4 ++--
Harald Hoyer 3610a1
 1 file changed, 2 insertions(+), 2 deletions(-)
Harald Hoyer 3610a1
Harald Hoyer 3610a1
diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
Harald Hoyer 3610a1
index b3ecf92d..2ca75d07 100755
Harald Hoyer 3610a1
--- a/modules.d/95nfs/module-setup.sh
Harald Hoyer 3610a1
+++ b/modules.d/95nfs/module-setup.sh
Harald Hoyer 3610a1
@@ -51,9 +51,9 @@ cmdline() {
Harald Hoyer 3610a1
 
Harald Hoyer 3610a1
     ### ip= ###
Harald Hoyer 3610a1
     if [[ $nfs_device = [0-9]*\.[0-9]*\.[0-9]*.[0-9]* ]] || [[ $nfs_device = \[.*\] ]]; then
Harald Hoyer 3610a1
-        nfs_address="$nfs_device"
Harald Hoyer 3610a1
+        nfs_address="${nfs_device%%:*}"
Harald Hoyer 3610a1
     else
Harald Hoyer 3610a1
-        lookup=$(host $(echo ${nfs_device%%:*})| head -n1)
Harald Hoyer 3610a1
+        lookup=$(host "${nfs_device%%:*}"| grep " address " | head -n1)
Harald Hoyer 3610a1
         nfs_address=${lookup##* }
Harald Hoyer 3610a1
     fi
Harald Hoyer 3610a1
     ifname=$(ip -o route get to $nfs_address | sed -n 's/.*dev \([^ ]*\).*/\1/p')
Harald Hoyer 3610a1