Blob Blame History Raw
From feaf30ffaa3365febe06ef3f0086778a6d364f0c Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 30 May 2013 11:38:23 +0200
Subject: [PATCH] network: wait for all required interfaces if "rd.neednet=1"

also set bootdev to the first configured interface, if missing

https://bugzilla.redhat.com/show_bug.cgi?id=801829
---
 modules.d/40network/net-genrules.sh  | 8 +++++---
 modules.d/40network/parse-ip-opts.sh | 9 ++++++---
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/modules.d/40network/net-genrules.sh b/modules.d/40network/net-genrules.sh
index 8bf6a89..8f28c93 100755
--- a/modules.d/40network/net-genrules.sh
+++ b/modules.d/40network/net-genrules.sh
@@ -14,8 +14,10 @@ fix_bootif() {
     echo $macaddr | sed 'y/ABCDEF/abcdef/'
 }
 
+getargbool 0 rd.neednet && NEEDNET=1
+
 # Don't continue if we don't need network
-if [ -z "$netroot" ] && [ ! -e "/tmp/net.ifaces" ] && ! getargbool 0 rd.neednet >/dev/null; then
+if [ -z "$netroot" ] && [ ! -e "/tmp/net.ifaces" ] && [ "$NEEDNET" != "1" ]; then
     return
 fi
 
@@ -73,13 +75,13 @@ fi
     elif [ -n "$IFACES" ] ; then
         for iface in $IFACES ; do
             printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="%s"\n' "$iface" "/sbin/initqueue --onetime $ifup"
-            if [ "$bootdev" = "$iface" ]; then
+            if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
                 echo "[ -f /tmp/setup_net_${iface}.ok ]" >$hookdir/initqueue/finished/wait-$iface.sh
             fi
         done
 
         for iface in $MASTER_IFACES; do
-            if [ "$bootdev" = "$iface" ]; then
+            if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
                 echo "[ -f /tmp/setup_net_${iface}.ok ]" >$hookdir/initqueue/finished/wait-$iface.sh
             fi
         done
diff --git a/modules.d/40network/parse-ip-opts.sh b/modules.d/40network/parse-ip-opts.sh
index c7dc3ce..f64c936 100755
--- a/modules.d/40network/parse-ip-opts.sh
+++ b/modules.d/40network/parse-ip-opts.sh
@@ -54,6 +54,12 @@ fi
 for p in $(getargs ip=); do
     ip_to_var $p
 
+    # make first device specified the BOOTDEV
+    if [ -z "$BOOTDEV" ] && [ -n "$dev" ]; then
+        BOOTDEV="$dev"
+        [ -n "$NEEDBOOTDEV" ] && warn "Setting bootdev to '$BOOTDEV'"
+    fi
+
     # skip ibft since we did it above
     [ "$autoconf" = "ibft" ] && continue
 
@@ -121,6 +127,3 @@ fi
 # Store BOOTDEV and IFACES for later use
 [ -n "$BOOTDEV" ] && echo $BOOTDEV > /tmp/net.bootdev
 [ -n "$IFACES" ]  && echo $IFACES > /tmp/net.ifaces
-
-# We need a ip= line for the configured bootdev=
-[ -n "$NEEDBOOTDEV" ] && [ -z "$BOOTDEVOK" ] && die "Bootdev Argument '$BOOTDEV' not found"