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