Split out the bits which determine ID_NET_DRIVER or DRIVERS into separate udev rules...
authorMichael Biebl <biebl@debian.org>
Fri, 28 Aug 2015 14:30:15 +0000 (16:30 +0200)
committerMichael Biebl <biebl@debian.org>
Mon, 31 Aug 2015 20:41:17 +0000 (22:41 +0200)
Those are not required with systemd-udevd v210 or newer. This way
distros which have a new enough version of udev can skip installing
84-nm-drivers.rules. While at it, don't use absolute paths for sed and
ethtool.

data/84-nm-drivers.rules [new file with mode: 0644]
data/85-nm-unmanaged.rules
data/Makefile.am

diff --git a/data/84-nm-drivers.rules b/data/84-nm-drivers.rules
new file mode 100644 (file)
index 0000000..d246ef6
--- /dev/null
@@ -0,0 +1,12 @@
+# Do not modify this file, it will get overwritten on updates.
+# To override or extend the rules place a file in /etc/udev/rules.d
+
+SUBSYSTEM!="net", GOTO="nm_drivers_end"
+ACTION!="add|change", GOTO="nm_drivers_end"
+
+# Determine ID_NET_DRIVER if there's no ID_NET_DRIVER or DRIVERS (old udev?)
+ENV{ID_NET_DRIVER}=="?*", GOTO="nm_drivers_end"
+DRIVERS=="?*", GOTO="nm_drivers_end"
+PROGRAM="/bin/sh -c 'ethtool -i $1 | sed -n s/^driver:\ //p' -- $env{INTERFACE}", RESULT=="?*", ENV{ID_NET_DRIVER}="%c"
+
+LABEL="nm_drivers_end"
index 9d2ad77..887ab84 100644 (file)
@@ -1,15 +1,9 @@
-# Do not modify this file, it will get overwriten on updates.
+# Do not modify this file, it will get overwritten on updates.
 # To override or extend the rules place a file in /etc/udev/rules.d
 
 SUBSYSTEM!="net", GOTO="nm_unmanaged_end"
 ACTION!="add|change", GOTO="nm_unmanaged_end"
 
-# Determine ID_NET_DRIVER if there's no ID_NET_DRIVER or DRIVERS (old udev?)
-ENV{ID_NET_DRIVER}=="?*", GOTO="nm_unmanaged_driver"
-DRIVERS=="?*", GOTO="nm_unmanaged_driver"
-PROGRAM="/bin/sh -c '/usr/sbin/ethtool -i $1 | /bin/sed -n s/^driver:\ //p' -- $env{INTERFACE}", RESULT=="?*", ENV{ID_NET_DRIVER}="%c"
-LABEL="nm_unmanaged_driver"
-
 # VirtualBox host networking. Out-of-tree driver that looks like an ordinary
 # Ethernet. No parent device (lives in /virtual/), no support for ethtool
 # to identify the driver, MAC address defaults to 08:00:27:, but can be
index 64ff337..ce059fc 100644 (file)
@@ -37,6 +37,7 @@ examples_DATA = server.conf
 if WITH_UDEV_DIR
 udevrulesdir = $(UDEV_DIR)/rules.d
 udevrules_DATA = \
+       84-nm-drivers.rules \
        85-nm-unmanaged.rules
 endif
 
@@ -57,6 +58,7 @@ EXTRA_DIST = \
        NetworkManager-wait-online-systemd-pre200.service.in \
        NetworkManager-dispatcher.service.in \
        org.freedesktop.NetworkManager.service.in \
+       84-nm-drivers.rules \
        85-nm-unmanaged.rules \
        server.conf.in