summaryrefslogtreecommitdiff
path: root/udev/contrib/debian/83-cdrom-symlinks.rules
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-03-14 00:14:26 +0000
committerdavidovski <david@davidovski.xyz>2022-03-14 00:14:26 +0000
commitdffbbe56d3f9f17da0244f75b352b87bc0e244df (patch)
treef9472179419c592a4fd42048270da0913f5e6024 /udev/contrib/debian/83-cdrom-symlinks.rules
parentbfdef0f304e13766423aaabd1022c888e3193ff6 (diff)
added udev
Diffstat (limited to 'udev/contrib/debian/83-cdrom-symlinks.rules')
-rw-r--r--udev/contrib/debian/83-cdrom-symlinks.rules12
1 files changed, 12 insertions, 0 deletions
diff --git a/udev/contrib/debian/83-cdrom-symlinks.rules b/udev/contrib/debian/83-cdrom-symlinks.rules
new file mode 100644
index 0000000..4713c0b
--- /dev/null
+++ b/udev/contrib/debian/83-cdrom-symlinks.rules
@@ -0,0 +1,12 @@
+# /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_aliases", SYMLINK+="%c"
+
+LABEL="cd_aliases_generator_end"