summaryrefslogtreecommitdiff
path: root/etc/udev/gentoo/udev.rules
diff options
context:
space:
mode:
Diffstat (limited to 'etc/udev/gentoo/udev.rules')
-rw-r--r--etc/udev/gentoo/udev.rules56
1 files changed, 33 insertions, 23 deletions
diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules
index d3f6c9b63f..f1e38b8d87 100644
--- a/etc/udev/gentoo/udev.rules
+++ b/etc/udev/gentoo/udev.rules
@@ -247,44 +247,54 @@ KERNEL=="tpm*", NAME="%k", OWNER="tss", GROUP="tss", MODE="0600"
# Persistant block device stuff - begin
#######################################
+# Skip all of this if we are not adding a block device
+ACTION!="add", GOTO="persistent_end"
+SUBSYSTEM!="block", GOTO="persistent_end"
+
# skip accessing removable ide devices, cause the ide drivers are horrible broken
-SUBSYSTEM=="block", BUS=="ide", SYSFS{removable}="1", GOTO="no_volume_id"
-SUBSYSTEM=="block", BUS=="ide", SYSFS{../removable}="1", GOTO="no_volume_id"
+BUS=="ide", SYSFS{removable}="1", GOTO="no_volume_id"
+BUS=="ide", SYSFS{../removable}="1", GOTO="no_volume_id"
# persistent disk device links /dev/disk/
-KERNEL=="hd*[!0-9]", ACTION=="add", IMPORT="/sbin/ata_id --export $tempnode"
+KERNEL=="hd*[!0-9]", IMPORT="/sbin/ata_id --export $tempnode"
KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}"
-KERNEL=="hd*[0-9]", ACTION=="add", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n"
-
-KERNEL=="sd*[!0-9]", ACTION=="add", SYSFS{ieee1394_id}=="*", IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394'"
-KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x"
-KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -s %p"
-KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -a -s %p"
-KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
-KERNEL=="sd*[0-9]", ACTION=="add", IMPORT{parent}=="ID_*"
+KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n"
+
+KERNEL=="sd*[!0-9]", SYSFS{ieee1394_id}=="*", IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394'"
+KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x"
+KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -s %p"
+KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -a -s %p"
+KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
+KERNEL=="sd*[0-9]", IMPORT{parent}=="ID_*"
KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
# Skip id for ram / loop / fd
-SUBSYSTEM=="block", KERNEL=="ram*", GOTO="no_volume_id"
-SUBSYSTEM=="block", KERNEL=="loop*", GOTO="no_volume_id"
-SUBSYSTEM=="block", KERNEL=="fd*", GOTO="no_volume_id"
+KERNEL=="ram*", GOTO="no_volume_id"
+KERNEL=="loop*", GOTO="no_volume_id"
+KERNEL=="fd*", GOTO="no_volume_id"
-SUBSYSTEM=="block", KERNEL=="*[!0-9]", ACTION=="add", ENV{ID_TYPE}=="?*", IMPORT="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}"
-SUBSYSTEM=="block", KERNEL=="*[0-9]", ACTION=="add", IMPORT{parent}=="ID_*"
-SUBSYSTEM=="block", KERNEL=="*[0-9]", ACTION=="add", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"
+KERNEL=="*[!0-9]", ENV{ID_TYPE}=="?*", IMPORT="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}"
+KERNEL=="*[0-9]", IMPORT{parent}=="ID_*"
+KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"
# volume-label/uuid
-SUBSYSTEM=="block", KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="no_volume_id"
-SUBSYSTEM=="block", KERNEL=="sr*", GOTO="no_volume_id"
-SUBSYSTEM=="block", KERNEL=="*[0-9]", ACTION=="add", IMPORT="/sbin/vol_id --export $tempnode"
-SUBSYSTEM=="block", KERNEL=="*[0-9]", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}"
-SUBSYSTEM=="block", KERNEL=="*[0-9]", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}"
-SUBSYSTEM=="block", LABEL="no_volume_id"
+KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="no_volume_id"
+KERNEL=="sr*", GOTO="no_volume_id"
+KERNEL=="*[0-9]", IMPORT="/sbin/vol_id --export $tempnode"
+KERNEL=="*[0-9]", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}"
+KERNEL=="*[0-9]", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}"
+LABEL="no_volume_id"
+
+LABEL="persistent_end"
#####################################
# Persistant block device stuff - end
#####################################
+# usbfs-like device nodes
+SUBSYSTEM="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev} B=$${X%%%%.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c"
+
+
# be backward compatible for a while with the /etc/dev.d and /etc/hotplug.d/ systems
# run /etc/hotplug.d/ stuff only if we came from a hotplug event, not for udevstart
ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd"