aboutsummaryrefslogtreecommitdiffstats
path: root/udev-lfs/83-cdrom-symlinks.rules
diff options
context:
space:
mode:
Diffstat (limited to 'udev-lfs/83-cdrom-symlinks.rules')
-rw-r--r--udev-lfs/83-cdrom-symlinks.rules13
1 files changed, 13 insertions, 0 deletions
diff --git a/udev-lfs/83-cdrom-symlinks.rules b/udev-lfs/83-cdrom-symlinks.rules
new file mode 100644
index 000000000..5d6b60078
--- /dev/null
+++ b/udev-lfs/83-cdrom-symlinks.rules
@@ -0,0 +1,13 @@
+# /etc/udev/rules.d/83-cdrom-symlinks.rules: Determine CD drive capability.
+
+ACTION!="add", GOTO="cd_aliases_generator_end"
+SUBSYSTEM!="block", GOTO="cd_aliases_generator_end"
+ENV{GENERATED}=="?*", GOTO="cd_aliases_generator_end"
+
+# Fail the uevent if the autogenerated rules cannot be saved
+ENV{ID_CDROM}=="?*", PROGRAM="/bin/grep -c ' / [^[:space:]]* rw' /proc/mounts", \
+ RESULT!="2", RUN+="/bin/false", GOTO="cd_aliases_generator_end"
+
+ENV{ID_CDROM}=="?*", PROGRAM="write_cd_rules", SYMLINK+="%c"
+
+LABEL="cd_aliases_generator_end"