summaryrefslogtreecommitdiff
path: root/source/a/udev
diff options
context:
space:
mode:
Diffstat (limited to 'source/a/udev')
-rw-r--r--source/a/udev/60-cdrom_id.rules.diff28
-rw-r--r--source/a/udev/config/rc.d/rc.udev.new9
-rw-r--r--source/a/udev/rule_generator.diff81
-rwxr-xr-xsource/a/udev/udev.SlackBuild11
4 files changed, 111 insertions, 18 deletions
diff --git a/source/a/udev/60-cdrom_id.rules.diff b/source/a/udev/60-cdrom_id.rules.diff
new file mode 100644
index 00000000..6ac5e227
--- /dev/null
+++ b/source/a/udev/60-cdrom_id.rules.diff
@@ -0,0 +1,28 @@
+--- ./src/cdrom_id/60-cdrom_id.rules.orig 2012-01-30 12:02:56.526251552 -0600
++++ ./src/cdrom_id/60-cdrom_id.rules 2013-01-17 21:11:20.821006629 -0600
+@@ -15,6 +15,24 @@
+ # enable the receiving of media eject button events
+ IMPORT{program}="cdrom_id --lock-media $devnode"
+
+-KERNEL=="sr0", SYMLINK+="cdrom", OPTIONS+="link_priority=-100"
++# create default links to the first detected device
++KERNEL=="sr0", ENV{ID_CDROM}=="1", SYMLINK+="cdrom", OPTIONS+="link_priority=-100"
++KERNEL=="sr0", ENV{ID_CDROM_CD_R}=="1", SYMLINK+="cdr", OPTIONS+="link_priority=-100"
++KERNEL=="sr0", ENV{ID_CDROM_CD_R}=="1", SYMLINK+="cdwriter", OPTIONS+="link_priority=-100"
++KERNEL=="sr0", ENV{ID_CDROM_CD_RW}=="1", SYMLINK+="cdrw", OPTIONS+="link_priority=-100"
++KERNEL=="sr0", ENV{ID_CDROM_DVD}=="1", SYMLINK+="dvd", OPTIONS+="link_priority=-100"
++KERNEL=="sr0", ENV{ID_CDROM_DVD_R}=="1", SYMLINK+="dvdr", OPTIONS+="link_priority=-100"
++KERNEL=="sr0", ENV{ID_CDROM_DVD_R}=="1", SYMLINK+="dvdwriter", OPTIONS+="link_priority=-100"
++KERNEL=="sr0", ENV{ID_CDROM_DVD_RW}=="1", SYMLINK+="dvdrw", OPTIONS+="link_priority=-100"
++
++# create all other device links
++KERNEL=="sr[0-9]*", ENV{ID_CDROM}=="1", SYMLINK+="cdrom%n", OPTIONS+="link_priority=-100"
++KERNEL=="sr[0-9]*", ENV{ID_CDROM_CD_R}=="1", SYMLINK+="cdr%n", OPTIONS+="link_priority=-100"
++KERNEL=="sr[0-9]*", ENV{ID_CDROM_CD_R}=="1", SYMLINK+="cdwriter%n", OPTIONS+="link_priority=-100"
++KERNEL=="sr[0-9]*", ENV{ID_CDROM_CD_RW}=="1", SYMLINK+="cdrw%n", OPTIONS+="link_priority=-100"
++KERNEL=="sr[0-9]*", ENV{ID_CDROM_DVD}=="1", SYMLINK+="dvd%n", OPTIONS+="link_priority=-100"
++KERNEL=="sr[0-9]*", ENV{ID_CDROM_DVD_R}=="1", SYMLINK+="dvdr%n", OPTIONS+="link_priority=-100"
++KERNEL=="sr[0-9]*", ENV{ID_CDROM_DVD_R}=="1", SYMLINK+="dvdwriter%n", OPTIONS+="link_priority=-100"
++KERNEL=="sr[0-9]*", ENV{ID_CDROM_DVD_RW}=="1", SYMLINK+="dvdrw%n", OPTIONS+="link_priority=-100"
+
+ LABEL="cdrom_end"
diff --git a/source/a/udev/config/rc.d/rc.udev.new b/source/a/udev/config/rc.d/rc.udev.new
index 2bbd9819..f000e938 100644
--- a/source/a/udev/config/rc.d/rc.udev.new
+++ b/source/a/udev/config/rc.d/rc.udev.new
@@ -112,7 +112,7 @@ case "$1" in
/sbin/udevadm trigger --type=devices --action=add
else # trigger changes for already running udevd
# If the persistent rules files do not exist, trigger an add event:
- if [ ! -r /etc/udev/rules.d/70-persistent-net.rules ]; then
+ if [ ! -r /etc/udev/rules.d/70-persistent-net.rules -o ! -r /etc/udev/rules.d/70-persistent-cd.rules ]; then
# Test that we can actually write to the directory first:
if touch /etc/udev/rules.d/testfile 2> /dev/null ; then
rm -f /etc/udev/rules.d/testfile
@@ -120,6 +120,13 @@ case "$1" in
echo "Triggering udev to write persistent rules to /etc/udev/rules.d/"
/sbin/udevadm trigger --type=devices --action=add
sleep 3
+ # Create the files if they don't exist at this point.
+ # If a machine does not have a network device or an optical
+ # device, we don't want to waste time trying to generate
+ # rules at every boot.
+ # To force another attempt, delete the file(s).
+ touch /etc/udev/rules.d/70-persistent-net.rules
+ touch /etc/udev/rules.d/70-persistent-cd.rules
fi
fi
# Since udevd is running, most of the time we only need change events:
diff --git a/source/a/udev/rule_generator.diff b/source/a/udev/rule_generator.diff
index 25c72b84..ff2acf80 100644
--- a/source/a/udev/rule_generator.diff
+++ b/source/a/udev/rule_generator.diff
@@ -1,17 +1,62 @@
-diff -Nur udev-182.orig/src/rule_generator/write_cd_rules udev-182/src/rule_generator/write_cd_rules
---- udev-182.orig/src/rule_generator/write_cd_rules 2012-03-24 22:47:53.138527732 -0500
-+++ udev-182/src/rule_generator/write_cd_rules 2012-03-24 22:59:42.595889830 -0500
+--- ./src/rule_generator/write_cd_rules.orig 2012-01-28 18:15:46.958827013 -0600
++++ ./src/rule_generator/write_cd_rules 2013-01-17 22:58:27.294859303 -0600
@@ -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 uses ID_PATH or ID_SERIAL or ID_MODEL and ID_REVISION to
++# by cdrom_id and uses ID_SERIAL or ID_MODEL and ID_REVISION to
+# identify the device.
# (C) 2006 Marco d'Itri <md@Linux.IT>
#
-@@ -105,18 +106,57 @@
+@@ -66,37 +67,16 @@
+ exit 1
+ fi
+
+-if [ "$1" ]; then
+- METHOD="$1"
++# ID_PATH is gone from the ata subsystem used in recent kernels, so
++# always use the by-id method:
++if [ "$ID_SERIAL" ]; then
++ RULE="ENV{ID_SERIAL}==\"$ID_SERIAL\""
++elif [ "$ID_MODEL" -a "$ID_REVISION" ]; then
++ RULE="ENV{ID_MODEL}==\"$ID_MODEL\", ENV{ID_REVISION}==\"$ID_REVISION\""
+ else
+- METHOD='by-path'
+-fi
+-
+-case "$METHOD" in
+- by-path)
+- if [ -z "$ID_PATH" ]; then
+- echo "$DEVPATH not supported by path_id. by-id may work." >&2
+- exit 1
+- fi
+- RULE="ENV{ID_PATH}==\"$ID_PATH\""
+- ;;
+-
+- by-id)
+- if [ "$ID_SERIAL" ]; then
+- RULE="ENV{ID_SERIAL}==\"$ID_SERIAL\""
+- elif [ "$ID_MODEL" -a "$ID_REVISION" ]; then
+- RULE="ENV{ID_MODEL}==\"$ID_MODEL\", ENV{ID_REVISION}==\"$ID_REVISION\""
+- else
+- echo "$DEVPATH not supported by ata_id. by-path may work." >&2
+- exit 1
+- fi
+- ;;
+-
+- *)
+- echo "Invalid argument (must be either by-path or by-id)." >&2
++ echo "$DEVPATH not supported by ata_id. Unable to generate persistent rules." >&2
+ exit 1
+- ;;
+-esac
++fi
+
+ # Prevent concurrent processes from modifying the file at the same time.
+ lock_rules_file
+@@ -105,18 +85,62 @@
choose_rules_file
link_num=$(find_next_available 'cdrom[0-9]*')
@@ -19,8 +64,9 @@ diff -Nur udev-182.orig/src/rule_generator/write_cd_rules udev-182/src/rule_gene
match="SUBSYSTEM==\"block\", ENV{ID_CDROM}==\"?*\", $RULE"
- comment="$ID_MODEL ($ID_PATH)"
+-comment="$ID_MODEL ($ID_PATH)"
-
++comment="$ID_MODEL ($ID_SERIAL)"
write_rule "$match" "cdrom$link_num" "$comment"
-[ "$ID_CDROM_CD_R" -o "$ID_CDROM_CD_RW" ] && \
- write_rule "$match" "cdrw$link_num"
@@ -28,47 +74,52 @@ diff -Nur udev-182.orig/src/rule_generator/write_cd_rules udev-182/src/rule_gene
- 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
++ if [ "$link_num" = "0" ]; 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$link_num"
++ if [ "$link_num" = "0" ]; then
+ write_rule "$match" "cdr"
+ fi
+
+ write_rule "$match" "cdwriter$link_num"
-+ if [ "$(find_all_rules 'SYMLINK+=' cdwriter)" = "" ]; then
++ if [ "$link_num" = "0" ]; 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
++ if [ "$link_num" = "0" ]; then
+ write_rule "$match" "cdrw"
+ fi
+ fi
+
-+ if [ "$(find_all_rules 'SYMLINK+=' writer)" = "" ]; then
++ if [ "$link_num" = "0" ]; 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
++ if [ "$link_num" = "0" ]; 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" "dvdr$link_num"
++ if [ "$link_num" = "0" ]; then
++ write_rule "$match" "dvdr"
++ fi
++
+ write_rule "$match" "dvdrw$link_num"
-+ if [ "$(find_all_rules 'SYMLINK+=' dvdrw)" = "" ]; then
++ if [ "$link_num" = "0" ]; then
+ write_rule "$match" "dvdrw"
+ fi
+
+ write_rule "$match" "dvdwriter$link_num"
-+ if [ "$(find_all_rules 'SYMLINK+=' dvdwriter)" = "" ]; then
++ if [ "$link_num" = "0" ]; then
+ write_rule "$match" "dvdwriter"
+ fi
+ fi
diff --git a/source/a/udev/udev.SlackBuild b/source/a/udev/udev.SlackBuild
index 183c6667..d39da262 100755
--- a/source/a/udev/udev.SlackBuild
+++ b/source/a/udev/udev.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2006, 2008, 2009, 2010, 2011, 2012 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2006, 2008, 2009, 2010, 2011, 2012, 2013 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -21,7 +21,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
VERSION=${VERSION:-$(echo udev-*.tar.* | cut -d - -f 2 | rev | cut -f 3- -d . | rev)}
-BUILD=${BUILD:-5}
+BUILD=${BUILD:-7}
NUMJOBS=${NUMJOBS:-" -j7 "}
@@ -67,10 +67,17 @@ zcat $CWD/fix-42-usb-hid-pm.rules.diff.gz | patch -p1 --verbose || exit 1
# Fixup the rule generator for our use
zcat $CWD/rule_generator.diff.gz | patch -p1 --verbose || exit 1
+# Patch 60-cdrom_id.rules to create a full set of symlinks.
+# This is needed for a hotplugged optical device since the generated
+# rules will not be used until the second time the device is plugged.
+zcat $CWD/60-cdrom_id.rules.diff.gz | patch -p1 --verbose || exit 1
+
# static libudev is needed for lvm2
# --enable-udev_acl was removed (will be part of future CK release)
# --enable-floppy support was also disabled by default in 173
# --enable-rule_generator was disabled by default in 175
+
+LDFLAGS="$LDFLAGS -lrt" \
./configure \
--prefix=/usr \
--with-rootprefix=/ \