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