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