r1098 - trunk/udev

jim at linuxfromscratch.org jim at linuxfromscratch.org
Wed Jan 25 11:04:09 PST 2006


Author: jim
Date: 2006-01-25 12:04:08 -0700 (Wed, 25 Jan 2006)
New Revision: 1098

Added:
   trunk/udev/check-cdrom.sh
Modified:
   trunk/udev/
Log:
 r1113 at server:  jim | 2006-01-25 11:03:38 -0800
 Added: new helper check-cdrom.sh



Property changes on: trunk/udev
___________________________________________________________________
Name: svk:merge
   - 3949c430-d905-0410-97b6-f115d20341b5:/udev:1348
3b7552df-c20a-0410-b7e1-d7eaf1be8828:/udev:1111
   + 3949c430-d905-0410-97b6-f115d20341b5:/udev:1348
3b7552df-c20a-0410-b7e1-d7eaf1be8828:/udev:1113

Added: trunk/udev/check-cdrom.sh
===================================================================
--- trunk/udev/check-cdrom.sh	                        (rev 0)
+++ trunk/udev/check-cdrom.sh	2006-01-25 19:04:08 UTC (rev 1098)
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+pos=0
+n=0
+sp="$1"
+what="$2"
+found=0
+
+[ -e /proc/sys/dev/cdrom/info ] || exit 1
+
+/bin/cat /proc/sys/dev/cdrom/info | { 
+	while read line; do
+		if [ "$found" = "0" -a "${line/drive name:}" != "$line" ]; then
+			set ${line/drive name:}	
+			while [ $# -gt 0 ]; do
+				pos=$[$pos+1]
+				if [ "$1" == "$sp" ]; then
+					found=1
+					break
+				fi
+				shift
+			done
+			[ "$found" = "0" ] && exit 1
+		elif [ "${line/$what:}" != "$line" ]; then
+			set ${line##*$what:}	
+			while [ $# -gt 0 ]; do
+				n=$[$n+1]
+				if [ "$n" == "$pos" ]; then
+					if [ "$1" = "1" ]; then
+						exit 0
+					fi
+					break
+				fi
+				shift
+			done
+		fi    
+	done
+exit 1
+}


Property changes on: trunk/udev/check-cdrom.sh
___________________________________________________________________
Name: svn:executable
   + *




More information about the cross-lfs mailing list