]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
network: add support for comma separated autoconf options
authorHarald Hoyer <harald@redhat.com>
Wed, 14 Jan 2015 10:28:16 +0000 (11:28 +0100)
committerHarald Hoyer <harald@redhat.com>
Wed, 14 Jan 2015 10:41:48 +0000 (11:41 +0100)
ip=eth0:auto6,dhcp

might work now

modules.d/40network/ifup.sh
modules.d/40network/parse-ip-opts.sh

index 66a3ff436c8571dd4ffafc8fc8e32f7e6267555d..cfd7df7ea0494cedfc9b3e57330c2b4db105d632 100755 (executable)
@@ -324,17 +324,19 @@ for p in $(getargs ip=); do
         eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
     done > /tmp/net.$netif.override
 
-    case $autoconf in
-        dhcp|on|any)
-            do_dhcp -4 ;;
-        dhcp6)
-            load_ipv6
-            do_dhcp -6 ;;
-        auto6)
-            do_ipv6auto ;;
-        *)
-            do_static ;;
-    esac
+    for autoopt in $(str_replace "$autoconf" "," " "); do
+        case $autoopt in
+            dhcp|on|any)
+                do_dhcp -4 ;;
+            dhcp6)
+                load_ipv6
+                do_dhcp -6 ;;
+            auto6)
+                do_ipv6auto ;;
+            *)
+                do_static ;;
+        esac
+    done
 
     > /tmp/net.${netif}.up
 
index 102a4adac20fb448dda70d683da7bb53b88cb8e6..a481b46a0a270ce250e12c111f6d74107265e03e 100755 (executable)
@@ -64,24 +64,26 @@ for p in $(getargs ip=); do
     fi
 
     # Error checking for autoconf in combination with other values
-    case $autoconf in
-        error) die "Error parsing option 'ip=$p'";;
-        bootp|rarp|both) die "Sorry, ip=$autoconf is currenty unsupported";;
-        none|off)
-            [ -z "$ip" ] && \
-            die "For argument 'ip=$p'\nValue '$autoconf' without static configuration does not make sense"
-            [ -z "$mask" ] && \
-                die "Sorry, automatic calculation of netmask is not yet supported"
-            ;;
-        auto6);;
-        dhcp|dhcp6|on|any) \
-            [ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
-            die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
-            [ -n "$ip" ] && \
-                die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoconf'"
-            ;;
-        *) die "For argument 'ip=$p'\nSorry, unknown value '$autoconf'";;
-    esac
+    for autoopt in $(str_replace "$autoconf" "," " "); do
+        case $autoopt in
+            error) die "Error parsing option 'ip=$p'";;
+            bootp|rarp|both) die "Sorry, ip=$autoopt is currenty unsupported";;
+            none|off)
+                [ -z "$ip" ] && \
+                    die "For argument 'ip=$p'\nValue '$autoopt' without static configuration does not make sense"
+                [ -z "$mask" ] && \
+                    die "Sorry, automatic calculation of netmask is not yet supported"
+                ;;
+            auto6);;
+            dhcp|dhcp6|on|any) \
+                [ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
+                    die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
+                [ -n "$ip" ] && \
+                    die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoopt'"
+                ;;
+            *) die "For argument 'ip=$p'\nSorry, unknown value '$autoopt'";;
+        esac
+    done
 
     if [ -n "$dev" ] ; then
         # We don't like duplicate device configs