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

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