source: udev/cdsymlink_helper.sh@ 26d1934

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

r3505@server: jim | 2006-05-14 17:40:44 -0700
Enhancements to the cdrom symlinks add on

  • Property mode set to 100755
File size: 1.0 KB
Line 
1#!/bin/sh
2########################################################################
3#
4# Description : cdsymlink_helper.sh
5#
6# Authors : Jim Gifford
7#
8# Version : 00.00
9#
10# Notes :
11#
12########################################################################
13
14. /lib/udev/helper.functions
15. /etc/sysconfig/udev_helper
16
17KERN_NAME="$1"
18BUS="$2"
19test=0
20
21if [ "$KERN_NAME" = "" ]; then
22 mesg Bad invocation: \$1 is not set
23 exit 1
24fi
25
26if [ "$BUS" = "ide" ]; then
27 FILES="`ls /sys/bus/ide/drivers/ide-cdrom | grep '\.' `"
28 for file in $FILES; do
29 TEST="`ls /sys/bus/ide/drivers/ide-cdrom/$file | grep -c $KERN_NAME`"
30 if [ "$TEST" = "1" ]; then
31 link="`echo $file | cut -f2 -d.`"
32 while [ $test -lt 1 ] ; do
33 if [ -e /dev/cdrom$link ]; then
34 link=$[$link+1]
35 else
36 test=1
37 echo $link
38 fi
39 done
40 fi
41 done
42fi
43
44if [ "$BUS" = "scsi" ]; then
45 link=$KERN_NAME
46 while [ $test -lt 1 ] ; do
47 if [ -e /dev/cdrom$link ]; then
48 link=$[$link+1]
49 else
50 test=1
51 echo $link
52 fi
53 done
54fi
55
Note: See TracBrowser for help on using the repository browser.