network: refix BOOTIF logic
authorHarald Hoyer <harald@redhat.com>
Thu, 13 Jun 2013 12:45:18 +0000 (14:45 +0200)
committerHarald Hoyer <harald@redhat.com>
Thu, 13 Jun 2013 13:15:19 +0000 (15:15 +0200)
modules.d/40network/net-genrules.sh
modules.d/40network/netroot.sh
modules.d/40network/parse-ip-opts.sh

index 43aa9e3..f6b7d9a 100755 (executable)
@@ -82,7 +82,7 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
     # Default: We don't know the interface to use, handle all
     # Fixme: waiting for the interface as well.
     else
-        cond='ACTION=="add|change", SUBSYSTEM=="net"'
+        cond='ACTION=="add", SUBSYSTEM=="net"'
         # if you change the name of "91-default-net.rules", also change modules.d/80cms/cmssetup.sh
         echo "$cond, $runcmd" > /etc/udev/rules.d/91-default-net.rules
     fi
index 9c481a8..1dcae51 100755 (executable)
@@ -20,6 +20,18 @@ command -v setup_net >/dev/null || . /lib/net-lib.sh
 netif=$1
 [ -e "/tmp/net.bootdev" ] && read netif < /tmp/net.bootdev
 
+case "$netif" in
+    ??:??:??:??:??:??)  # MAC address
+        for i in /sys/class/net/*/address; do
+            mac=$(cat $i)
+            if [ "$mac" = "$netif" ]; then
+                i=${i%/address}
+                netif=${i##*/}
+                break
+            fi
+        done
+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
index bdd71db..4ca5098 100755 (executable)
@@ -17,7 +17,7 @@
 command -v getarg >/dev/null          || . /lib/dracut-lib.sh
 command -v ibft_to_cmdline >/dev/null || . /lib/net-lib.sh
 
-if [ -n "$netroot" ] && [ -z "$(getarg ip=)" ] ; then
+if [ -n "$netroot" ] && [ -z "$(getarg ip=)" ] && [ -z "$(getarg BOOTIF=)" ]; then
     # No ip= argument(s) for netroot provided, defaulting to DHCP
     return;
 fi
@@ -113,7 +113,8 @@ done
 
 # put BOOTIF in IFACES to make sure it comes up
 if BOOTIF="$(getarg BOOTIF=)"; then
-    IFACES="$IFACES $(fix_bootif $BOOTIF)"
+    BOOTDEV=$(fix_bootif $BOOTIF)
+    IFACES="$BOOTDEV $IFACES"
 fi
 
 # This ensures that BOOTDEV is always first in IFACES