Blame SOURCES/0341-network-netroot.sh-better-handling-of-netroot-and-dh.patch

18971c
From 17cee31b115a146bca5519b6ac4b422080d764c7 Mon Sep 17 00:00:00 2001
18971c
From: Harald Hoyer <harald@redhat.com>
18971c
Date: Thu, 10 Sep 2015 13:23:32 +0200
18971c
Subject: [PATCH] network/netroot.sh: better handling of $netroot and dhcp
18971c
18971c
if $netroot is emtpy, get it from cmdline
18971c
18971c
check cmdline directly for root=dhcp(6) and netroot=dhcp(6)
18971c
---
18971c
 modules.d/40network/netroot.sh | 17 +++++++++++------
18971c
 1 file changed, 11 insertions(+), 6 deletions(-)
18971c
18971c
diff --git a/modules.d/40network/netroot.sh b/modules.d/40network/netroot.sh
18971c
index 8f6945fe..3aa5a0d2 100755
18971c
--- a/modules.d/40network/netroot.sh
18971c
+++ b/modules.d/40network/netroot.sh
18971c
@@ -14,6 +14,11 @@ command -v setup_net >/dev/null || . /lib/net-lib.sh
18971c
 # no sense in doing something if no (net)root info is available
18971c
 # or root is already there
18971c
 [ -d $NEWROOT/proc ] && exit 0
18971c
+
18971c
+if [ -z "$netroot" ]; then
18971c
+    netroot=$(getarg netroot=)
18971c
+fi
18971c
+
18971c
 [ -z "$netroot" ] && exit 1
18971c
 
18971c
 # Set or override primary interface
18971c
@@ -35,7 +40,7 @@ esac
18971c
 # Figure out the handler for root=dhcp by recalling all netroot cmdline
18971c
 # handlers when this is not called from manually network bringing up.
18971c
 if [ -z "$2" ]; then
18971c
-    if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] ; then
18971c
+    if getarg "root=dhcp" || getarg "netroot=dhcp" || getarg "root=dhcp6" || getarg "netroot=dhcp6"; then
18971c
         # Load dhcp options
18971c
         [ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
18971c
 
18971c
@@ -47,6 +52,8 @@ if [ -z "$2" ]; then
18971c
             exit 1
18971c
         fi
18971c
 
18971c
+        rm -f -- $hookdir/initqueue/finished/dhcp.sh
18971c
+
18971c
         # Set netroot to new_root_path, so cmdline parsers don't call
18971c
         netroot=$new_root_path
18971c
 
18971c
@@ -76,9 +83,7 @@ source_hook netroot $netif
18971c
 
18971c
 # Run the handler; don't store the root, it may change from device to device
18971c
 # XXX other variables to export?
18971c
-if $handler $netif $netroot $NEWROOT; then
18971c
-    rm -f -- $hookdir/initqueue/finished/dhcp.sh
18971c
-    # Network rootfs mount successful - save interface info for ifcfg etc.
18971c
-    save_netinfo $netif
18971c
-fi
18971c
+[ -n "$handler" ] && "$handler" "$netif" "$netroot" "$NEWROOT"
18971c
+save_netinfo $netif
18971c
+
18971c
 exit 0