]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
make root=dhcp work
authorHarald Hoyer <harald@redhat.com>
Mon, 25 May 2009 14:48:01 +0000 (16:48 +0200)
committerHarald Hoyer <harald@redhat.com>
Mon, 25 May 2009 14:48:01 +0000 (16:48 +0200)
modules.d/40network/ifup

index 284c9df8e42672d4c4855fddbcfe69576416874c..d60ff19789adfa9ff9933b68b1c0423d1fa70041 100755 (executable)
@@ -93,20 +93,27 @@ ip_to_var() {
     [ -n "$autoconf" ] || autoconf=off
 }
 
-# spin through the kernel command line, looking for ip= lines
-for p in $(cat /proc/cmdline); do
-    [ -n "${p%ip=*}" ] && continue
-    ip_to_var ${p#ip=}
-
-    # If this option isn't directed at our interface, skip it
-    [ "$dev" = "$netif" ] || continue
-
-    case $autoconf in
-       static)          do_static ;;
-       dhcp|on|any)     do_dhcp ;;
-       bootp|rarp|both) die "autoconfig type $autoconf is not supported" ;;
-       ''|none|off)     ;;
-    esac
-    break
-done
+root=$(getarg root)
+ip=$(getarg ip)
+
+if [ "$root" = "dhcp" -a -z "$ip" ]; then
+    do_dhcp;
+else
+    # spin through the kernel command line, looking for ip= lines
+    for p in $(cat /proc/cmdline); do
+       [ -n "${p%ip=*}" ] && continue
+       ip_to_var ${p#ip=}
+       
+        # If this option isn't directed at our interface, skip it
+       [ "$dev" = "$netif" ] || continue
+
+       case $autoconf in
+           static)              do_static ;;
+           dhcp|on|any)         do_dhcp ;;
+           bootp|rarp|both) die "autoconfig type $autoconf is not supported" ;;
+           ''|none|off)         ;;
+       esac
+       break
+    done
+fi
 exit 0