source: udev/check-cdrom.sh@ d49b9e8

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since d49b9e8 was 05139a3, checked in by Jim Gifford <clfs@…>, 19 years ago

r1100@server (orig r1098): jim | 2006-01-25 11:04:08 -0800

r1113@server: jim | 2006-01-25 11:03:38 -0800
Added: new helper check-cdrom.sh


  • Property mode set to 100755
File size: 655 bytes
Line 
1#!/bin/bash
2
3pos=0
4n=0
5sp="$1"
6what="$2"
7found=0
8
9[ -e /proc/sys/dev/cdrom/info ] || exit 1
10
11/bin/cat /proc/sys/dev/cdrom/info | {
12 while read line; do
13 if [ "$found" = "0" -a "${line/drive name:}" != "$line" ]; then
14 set ${line/drive name:}
15 while [ $# -gt 0 ]; do
16 pos=$[$pos+1]
17 if [ "$1" == "$sp" ]; then
18 found=1
19 break
20 fi
21 shift
22 done
23 [ "$found" = "0" ] && exit 1
24 elif [ "${line/$what:}" != "$line" ]; then
25 set ${line##*$what:}
26 while [ $# -gt 0 ]; do
27 n=$[$n+1]
28 if [ "$n" == "$pos" ]; then
29 if [ "$1" = "1" ]; then
30 exit 0
31 fi
32 break
33 fi
34 shift
35 done
36 fi
37 done
38exit 1
39}
Note: See TracBrowser for help on using the repository browser.