r1589 - / trunk/udev

jim at linuxfromscratch.org jim at linuxfromscratch.org
Sun May 14 11:44:36 PDT 2006


Author: jim
Date: 2006-05-14 12:44:34 -0600 (Sun, 14 May 2006)
New Revision: 1589

Added:
   trunk/udev/cdsymlink_helper.sh
Modified:
   /
   trunk/udev/
   trunk/udev/35-helper.rules
   trunk/udev/Makefile
Log:
 r3467 at server (orig r1623):  jim | 2006-05-14 11:08:01 -0700
  r3465 at server:  jim | 2006-05-14 11:07:31 -0700
  Fixed cd symlinks
 



Property changes on: 
___________________________________________________________________
Name: svk:merge
   - b6734a72-470d-0410-b049-f317dca95413:/:1622
   + b6734a72-470d-0410-b049-f317dca95413:/:1623


Property changes on: trunk/udev
___________________________________________________________________
Name: svk:merge
   - 38c7b366-470d-0410-a457-935707c16d9b:/udev:3464
3949c430-d905-0410-97b6-f115d20341b5:/udev:1348
3b7552df-c20a-0410-b7e1-d7eaf1be8828:/udev:1263
   + 38c7b366-470d-0410-a457-935707c16d9b:/udev:3465
3949c430-d905-0410-97b6-f115d20341b5:/udev:1348
3b7552df-c20a-0410-b7e1-d7eaf1be8828:/udev:1263

Modified: trunk/udev/35-helper.rules
===================================================================
--- trunk/udev/35-helper.rules	2006-05-14 18:44:24 UTC (rev 1588)
+++ trunk/udev/35-helper.rules	2006-05-14 18:44:34 UTC (rev 1589)
@@ -23,11 +23,18 @@
 BUS=="scsi",	KERNEL=="scd[a-z]", ACTION=="add", IMPORT="cdrom_id --export $tempnode"
 BUS=="scsi",	KERNEL=="sg[0-9]*", ACTION=="add", DRIVER=="sr", GROUP="cdrom"
 
-ENV{ID_CDROM}=="?*",		SYMLINK+="cdrom%m", GROUP="cdrom"
-ENV{ID_CDROM_CD_R}=="?*",	SYMLINK+="cdr%m"
-ENV{ID_CDROM_CD_RW}=="?*",	SYMLINK+="cdrw%m"
-ENV{ID_CDROM_DVD}=="?*",	SYMLINK+="dvd%m"
-ENV{ID_CDROM_DVD_R}=="?*",	SYMLINK+="dvdrw%m"
+BUS=="ide", 	ENV{ID_CDROM}=="?*", SYMLINK+="cdrom-temp", GROUP="cdrom"
+BUS=="ide",	ENV{ID_CDROM_CD_R}=="?*", SYMLINK+="cdr-temp"
+BUS=="ide",	ENV{ID_CDROM_CD_RW}=="?*", SYMLINK+="cdrw-temp"
+BUS=="ide",	ENV{ID_CDROM_DVD}=="?*", SYMLINK+="dvd-temp"
+BUS=="ide",	ENV{ID_CDROM_DVD_R}=="?*", SYMLINK+="dvdrw-temp"
+BUS=="ide",	KERNEL=="hd[a-z]", ACTION=="add", RUN+="cdsymlink_helper.sh %k"
 
+BUS=="scsi", 	ENV{ID_CDROM}=="?*", SYMLINK+="cdrom%n", GROUP="cdrom"
+BUS=="scsi",	ENV{ID_CDROM_CD_R}=="?*", SYMLINK+="cdr%n"
+BUS=="scsi",	ENV{ID_CDROM_CD_RW}=="?*", SYMLINK+="cdrw%n"
+BUS=="scsi",	ENV{ID_CDROM_DVD}=="?*", SYMLINK+="dvd%n"
+BUS=="scsi",	ENV{ID_CDROM_DVD_R}=="?*", SYMLINK+="dvdrw%n"
+
 # adds floppy devices
 KERNEL=="fd[0-9]*", ACTION=="add", SYSFS{cmos}=="*", RUN+="create_floppy_devices -c -t $sysfs{cmos} -m %M /dev/%k"t

Modified: trunk/udev/Makefile
===================================================================
--- trunk/udev/Makefile	2006-05-14 18:44:24 UTC (rev 1588)
+++ trunk/udev/Makefile	2006-05-14 18:44:34 UTC (rev 1589)
@@ -30,6 +30,7 @@
 
 scripts:
 	install -m ${SCRIPTMODE} load_floppy_module.sh ${DESTDIR}/lib/udev/load_floppy_module.sh
+	install -m ${SCRIPTMODE} cdsymlink_helper.sh ${DESTDIR}/lib/udev/cdsymlink_helper.sh
 
 boot:
 	install -d ${DESTDIR}/usr/share/udev

Added: trunk/udev/cdsymlink_helper.sh
===================================================================
--- trunk/udev/cdsymlink_helper.sh	                        (rev 0)
+++ trunk/udev/cdsymlink_helper.sh	2006-05-14 18:44:34 UTC (rev 1589)
@@ -0,0 +1,69 @@
+#!/bin/sh
+########################################################################
+#
+# Description : cdsymlink_helper.sh
+#
+# Authors     : Jim Gifford
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+. /lib/udev/helper.functions
+. /etc/sysconfig/udev_helper
+
+KERN_NAME="$1"
+
+if [ "$KERN_NAME" = "" ]; then
+	mesg Bad invocation: \$1 is not set
+	exit 1
+fi
+case $ACTION in
+	add)
+		if [ -e /dev/cdrom-temp ]; then
+			FILES="`ls /sys/bus/ide/drivers/ide-cdrom | grep 1.`"
+			for file in $FILES; do
+				TEST="`ls /sys/bus/ide/drivers/ide-cdrom/$file | grep -c $KERN_NAME`"
+				if [ "$TEST" = "1" ]; then
+					link="`echo $file | cut -f2 -d.`"
+					if [ -e /dev/cdrom-temp ]; then
+						mv /dev/cdrom-temp /dev/cdrom$link
+					fi
+					if [ -e /dev/cdr-temp ]; then
+						mv /dev/cdr-temp /dev/cdr$link
+					fi
+					if [ -e /dev/cdrw-temp ]; then
+						mv /dev/cdrw-temp /dev/cdrw$link
+					fi
+					if [ -e /dev/dvd-temp ]; then
+						mv /dev/dvd-temp /dev/dvd$link
+					fi
+					if [ -e /dev/dvdr-temp ]; then
+						mv /dev/dvdr-temp /dev/dvdr$link
+					fi
+					if [ -e /dev/dvdrw-temp ]; then
+						mv /dev/dvdrw-temp /dev/dvdrw$link
+					fi
+				fi
+			done
+		fi
+	;;
+
+	remove)
+		FILES="`ls /sys/bus/ide/drivers/ide-cdrom | grep 1.`"
+		echo "at remove" > /tmp/cdrom
+		for file in $FILES; do
+			TEST="`find /sys/bus/ide/drivers/ide-cdrom/$file -name $KERN_NAME`"
+			if [ "$TEST" != "" ]; then
+				link="`echo $file | cut -f2 -d.`"
+				rm /dev/cdrom$link /dev/cdr$link /dev/cdrw$link /dev/dvd$link /dev/dvdrw$link
+			fi
+		done
+	;;
+
+	*)
+	exit 1
+	;;
+esac


Property changes on: trunk/udev/cdsymlink_helper.sh
___________________________________________________________________
Name: svn:executable
   + *




More information about the cross-lfs mailing list