2010-05-19 10:58:23 +02:00
|
|
|
diff -Naur udev.orig/extras/rule_generator/write_cd_rules udev/extras/rule_generator/write_cd_rules
|
|
|
|
--- udev.orig/extras/rule_generator/write_cd_rules 2009-05-19 00:24:39.000000000 -0300
|
|
|
|
+++ udev/extras/rule_generator/write_cd_rules 2009-05-19 01:02:17.000000000 -0300
|
2009-08-26 17:00:38 +02:00
|
|
|
@@ -3,7 +3,8 @@
|
|
|
|
# This script is run if an optical drive lacks a rule for persistent naming.
|
|
|
|
#
|
|
|
|
# It adds symlinks for optical drives based on the device class determined
|
|
|
|
-# by cdrom_id and used ID_PATH to identify the device.
|
|
|
|
+# by cdrom_id and used ID_PATH or ID_SERIAL or ID_MODEL and ID_REVISION
|
|
|
|
+# to identify the device.
|
|
|
|
#
|
|
|
|
# (C) 2006 Marco d'Itri <md@Linux.IT>
|
|
|
|
#
|
2010-05-19 10:58:23 +02:00
|
|
|
@@ -96,18 +97,57 @@
|
2009-08-26 17:00:38 +02:00
|
|
|
choose_rules_file
|
|
|
|
|
|
|
|
link_num=$(find_next_available 'cdrom[0-9]*')
|
|
|
|
+[ "$link_num" = "" ] && link_num=0
|
|
|
|
|
2010-05-19 10:58:23 +02:00
|
|
|
match="SUBSYSTEM==\"block\", ENV{ID_CDROM}==\"?*\", $RULE"
|
2009-08-26 17:00:38 +02:00
|
|
|
|
|
|
|
comment="$ID_MODEL ($ID_PATH)"
|
|
|
|
-
|
|
|
|
write_rule "$match" "cdrom$link_num" "$comment"
|
|
|
|
-[ "$ID_CDROM_CD_R" -o "$ID_CDROM_CD_RW" ] && \
|
|
|
|
- write_rule "$match" "cdrw$link_num"
|
|
|
|
-[ "$ID_CDROM_DVD" ] && \
|
|
|
|
- write_rule "$match" "dvd$link_num"
|
|
|
|
-[ "$ID_CDROM_DVD_R" -o "$ID_CDROM_DVD_RW" -o "$ID_CDROM_DVD_RAM" ] && \
|
|
|
|
- write_rule "$match" "dvdrw$link_num"
|
|
|
|
+ if [ "$(find_all_rules 'SYMLINK+=' cdrom)" = "" ]; then
|
|
|
|
+ write_rule "$match" "cdrom"
|
|
|
|
+ fi
|
|
|
|
+
|
|
|
|
+ if [ "$ID_CDROM_CD_R" ]; then
|
|
|
|
+ write_rule "$match" "cdr$link_num"
|
|
|
|
+ if [ "$(find_all_rules 'SYMLINK+=' cdr)" = "" ]; then
|
|
|
|
+ write_rule "$match" "cdr"
|
|
|
|
+ fi
|
|
|
|
+
|
|
|
|
+ write_rule "$match" "cdwriter$link_num"
|
|
|
|
+ if [ "$(find_all_rules 'SYMLINK+=' cdwriter)" = "" ]; then
|
|
|
|
+ write_rule "$match" "cdwriter"
|
|
|
|
+ fi
|
|
|
|
+
|
|
|
|
+ if [ "$ID_CDROM_CD_RW" ]; then
|
|
|
|
+ write_rule "$match" "cdrw$link_num"
|
|
|
|
+ if [ "$(find_all_rules 'SYMLINK+=' cdrw)" = "" ]; then
|
|
|
|
+ write_rule "$match" "cdrw"
|
|
|
|
+ fi
|
|
|
|
+ fi
|
|
|
|
+
|
|
|
|
+ if [ "$(find_all_rules 'SYMLINK+=' writer)" = "" ]; then
|
|
|
|
+ write_rule "$match" "writer"
|
|
|
|
+ fi
|
|
|
|
+ fi
|
|
|
|
+
|
|
|
|
+ if [ "$ID_CDROM_DVD" ]; then
|
|
|
|
+ write_rule "$match" "dvd$link_num"
|
|
|
|
+ if [ "$(find_all_rules 'SYMLINK+=' dvd)" = "" ]; then
|
|
|
|
+ write_rule "$match" "dvd"
|
|
|
|
+ fi
|
|
|
|
+
|
|
|
|
+ if [ "$ID_CDROM_DVD_R" -o "$ID_CDROM_DVD_RW" -o "$ID_CDROM_DVD_RAM" ]; then
|
|
|
|
+ write_rule "$match" "dvdrw$link_num"
|
|
|
|
+ if [ "$(find_all_rules 'SYMLINK+=' dvdrw)" = "" ]; then
|
|
|
|
+ write_rule "$match" "dvdrw"
|
|
|
|
+ fi
|
|
|
|
+
|
|
|
|
+ write_rule "$match" "dvdwriter$link_num"
|
|
|
|
+ if [ "$(find_all_rules 'SYMLINK+=' dvdwriter)" = "" ]; then
|
|
|
|
+ write_rule "$match" "dvdwriter"
|
|
|
|
+ fi
|
|
|
|
+ fi
|
|
|
|
+ fi
|
2010-05-19 10:58:23 +02:00
|
|
|
echo >> $RULES_FILE
|
2009-08-26 17:00:38 +02:00
|
|
|
|
|
|
|
unlock_rules_file
|