]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
network/net-genrules.sh: react also on NAME
authorHarald Hoyer <harald@redhat.com>
Tue, 10 Sep 2013 08:48:18 +0000 (10:48 +0200)
committerHarald Hoyer <harald@redhat.com>
Tue, 10 Sep 2013 08:48:18 +0000 (10:48 +0200)
Recent systemd-udevd network renaming rules work on NAME.
Also enqueue only one unique initqueue job.

modules.d/40network/net-genrules.sh

index 31cd1e6754fa0d5e190379ccb240a35a2e07c589..c4def61b285032614904ab10f7f0c74623b1dd1e 100755 (executable)
@@ -54,23 +54,30 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
     ifup='/sbin/ifup $env{INTERFACE}'
     [ -z "$netroot" ] && ifup="$ifup -m"
 
-    runcmd="RUN+=\"/sbin/initqueue --onetime $ifup\""
+    runcmd="RUN+=\"/sbin/initqueue --name ifup-\$env{INTERFACE} --unique --onetime $ifup\""
 
     # We have some specific interfaces to handle
     if [ -n "$IFACES" ]; then
         echo 'SUBSYSTEM!="net", GOTO="net_end"'
-        echo 'ACTION=="remove", GOTO="net_end"'
+        echo 'ACTION!="add|change|move", GOTO="net_end"'
         for iface in $IFACES; do
             case "$iface" in
                 ??:??:??:??:??:??)  # MAC address
-                    cond="ATTR{address}==\"$iface\"" ;;
+                    cond="ATTR{address}==\"$iface\""
+                    echo "$cond, $runcmd, GOTO=\"net_end\""
+                    ;;
                 ??-??-??-??-??-??)  # MAC address in BOOTIF form
-                    cond="ATTR{address}==\"$(fix_bootif $iface)\"" ;;
+                    cond="ATTR{address}==\"$(fix_bootif $iface)\""
+                    echo "$cond, $runcmd, GOTO=\"net_end\""
+                    ;;
                 *)                  # an interface name
-                    cond="ENV{INTERFACE}==\"$iface\"" ;;
+                    cond="ENV{INTERFACE}==\"$iface\""
+                    echo "$cond, $runcmd, GOTO=\"net_end\""
+                    cond="NAME==\"$iface\""
+                    echo "$cond, $runcmd, GOTO=\"net_end\""
+                    ;;
             esac
             # The GOTO prevents us from trying to ifup the same device twice
-            echo "$cond, $runcmd, GOTO=\"net_end\""
         done
         echo 'LABEL="net_end"'