File 0631-nfsroot-follow-ifcfg-settings-for-boot-protocol.patch of Package dracut.28355

From 9cc1b76087c3ff17609a28f2142c2c62cd6cc97b Mon Sep 17 00:00:00 2001
From: Thomas Blume <thomas.blume@suse.com>
Date: Wed, 19 Jun 2019 15:15:57 +0200
Subject: [PATCH] nfsroot follow ifcfg settings for boot protocol

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

diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
index 2ca75d07..dce457f4 100755
--- a/modules.d/95nfs/module-setup.sh
+++ b/modules.d/95nfs/module-setup.sh
@@ -65,7 +65,12 @@ cmdline() {
         printf 'ifname=%s:%s ' ${ifname} ${ifmac}
     fi
 
-    printf 'ip=%s:static\n' ${ifname}
+    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
 }
 
 # called by dracut
-- 
2.32.0

openSUSE Build Service is sponsored by