]> 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:21 +0000 (11:41 +0100)
ip=eth0:auto6,dhcp

might work now

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

index 67b1d9f8b628b8dfeb308258a54cef3f4262428d..8749c4c2531077d8292f887a1915052da2d09b1a 100755 (executable)
@@ -326,17 +326,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 b029d0073987982c0199343a9121c01e100c0bae..5b96e069bc95eb3df8246d91eba9b2ad920030b3 100755 (executable)
@@ -66,24 +66,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