File 0544-40network-Make-ip-dhcp-work.patch of Package dracut.28355

From 9d4167efa9b6f093f1a37cb07bc744e763a5d292 Mon Sep 17 00:00:00 2001
From: Daniel Molkentin <dmolkentin@suse.com>
Date: Fri, 8 Dec 2017 09:51:47 +0100
Subject: [PATCH] 40network: Make ip=dhcp work

This fixes ip=dhcp to behave exactly like ip=<dev>:dhcp, as indicated
in the documentation.

Reference: bsc#1069163
---
 modules.d/40network/ifup.sh | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
index a684cba0..d9a418e5 100755
--- a/modules.d/40network/ifup.sh
+++ b/modules.d/40network/ifup.sh
@@ -497,6 +497,19 @@ if [ -z "$ip" ]; then
     fi
 fi
 
+bring_online() {
+    > /tmp/net.${netif}.up
+
+    if [ -e /sys/class/net/${netif}/address ]; then
+        > /tmp/net.$(cat /sys/class/net/${netif}/address).up
+    fi
+
+    setup_net $netif
+    source_hook initqueue/online $netif
+    if [ -z "$manualup" ]; then
+        /sbin/netroot $netif
+    fi
+}
 
 # Specific configuration, spin through the kernel command line
 # looking for ip= lines
@@ -555,17 +568,7 @@ for p in $(getargs ip=); do
     done
 
     if [ $? -eq 0 ]; then
-        > /tmp/net.${netif}.up
-
-        if [ -e /sys/class/net/${netif}/address ]; then
-            > /tmp/net.$(cat /sys/class/net/${netif}/address).up
-        fi
-
-        setup_net $netif
-        source_hook initqueue/online $netif
-        if [ -z "$manualup" ]; then
-            /sbin/netroot $netif
-        fi
+        bring_online
     fi
 done
 
@@ -593,6 +596,9 @@ if [ ! -e /tmp/net.${netif}.up ]; then
             do_dhcp -4
         fi
     fi
+    if [ $? -eq 0 ]; then
+        bring_online
+    fi
 fi
 
 if [ -e /tmp/net.${netif}.up ]; then
-- 
2.13.6

openSUSE Build Service is sponsored by