chiark / gitweb /
tweak the gentoo rules some more.
[elogind.git] / etc / udev / gentoo / udev.rules
index 75c192ffaa2774811d7bd3b5b482f977b26a0e5e..f1e38b8d870f1c50adad4b4e261b7cb6ba13cb48 100644 (file)
@@ -33,13 +33,13 @@ KERNEL=="ircomm*",  NAME="%k", GROUP="tty"
 SUBSYSTEM=="block", GROUP="disk"
 
 # cdrom symlinks and other good cdrom naming
-BUS=="ide",  KERNEL="hd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK+="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}"
-BUS=="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK+="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}"
-BUS=="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK+="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}"
-
-# devfs-names for ide-devices (uncomment only one)
-#  /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names
-BUS=="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK+="%c{1} %c{2}", GROUP="%c{3}"
+BUS=="ide",    KERNEL=="hd[a-z]", ACTION=="add", IMPORT="/sbin/cdrom_id --export $tempnode"
+BUS=="scsi",   KERNEL="sr[0-9]*", ACTION=="add", IMPORT="/sbin/cdrom_id --export $tempnode"
+BUS=="scsi",   KERNEL="scd[a-z]", ACTION=="add", IMPORT="/sbin/cdrom_id --export $tempnode"
+ENV{ID_CDROM}=="?*",           SYMLINK+="cdrom%e", GROUP="cdrom"
+ENV{ID_CDROM_CD_RW}=="?*",     SYMLINK+="cdrw%e"
+ENV{ID_CDROM_DVD}=="?*",       SYMLINK+="dvd%e"
+ENV{ID_CDROM_DVD_R}=="?*",     SYMLINK+="dvdrw%e"
 
 # disk devices
 KERNEL=="sd*",         NAME="%k", GROUP="disk"
@@ -243,6 +243,58 @@ KERNEL=="issm*",   NAME="infiniband/%k"
 # tpm devices
 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
+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]", 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]", 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
+KERNEL=="ram*", GOTO="no_volume_id"
+KERNEL=="loop*", GOTO="no_volume_id"
+KERNEL=="fd*", GOTO="no_volume_id"
+
+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
+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"
@@ -250,3 +302,5 @@ ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd"
 # always run /etc/dev.d/ stuff for now.
 RUN+="/sbin/udev_run_devd"
 
+# debugging monitor
+RUN+="socket:/org/kernel/udev/monitor"