Contents of /trunk/udev/config-udev-046/cdrom-devfs.sh
Parent Directory | Revision Log
Revision 2 -
(show annotations)
(download)
(as text)
Fri Dec 10 12:17:31 2004 UTC (19 years, 9 months ago) by niro
Original Path: branches/unlabeled-1.1.1/udev/config-udev-046/cdrom-devfs.sh
File MIME type: application/x-sh
File size: 790 byte(s)
Fri Dec 10 12:17:31 2004 UTC (19 years, 9 months ago) by niro
Original Path: branches/unlabeled-1.1.1/udev/config-udev-046/cdrom-devfs.sh
File MIME type: application/x-sh
File size: 790 byte(s)
magellan sources, patches
1 | #!/bin/sh |
2 | |
3 | # udev external PROGRAM script |
4 | # return devfs-names for ide-devices |
5 | # BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}" |
6 | |
7 | get_dev_number() { |
8 | local x= |
9 | local num=0 |
10 | local MEDIA= |
11 | local DRIVE="${1%%[0-9]*}" |
12 | |
13 | for x in /proc/ide/*/media; do |
14 | if [ -e "${x}" ]; then |
15 | MEDIA=`cat ${x}` |
16 | if [ "${MEDIA}" = "$2" ]; then |
17 | num=$((${num} + 1)) |
18 | fi |
19 | if [ "${x}" = "/proc/ide/${DRIVE}/media" ]; then |
20 | break |
21 | fi |
22 | fi |
23 | done |
24 | |
25 | echo $((${num} - 1)) |
26 | } |
27 | |
28 | |
29 | DEVICE=$1 |
30 | |
31 | if [ -e /proc/ide/${DEVICE}/media ] |
32 | then |
33 | x=`/bin/cat /proc/ide/${DEVICE}/media` |
34 | |
35 | if [ "${x}" = "cdrom" ] |
36 | then |
37 | i=`get_dev_number ${DEVICE} cdrom` |
38 | if [ ${i} -eq 0 ] |
39 | then |
40 | i="" |
41 | fi |
42 | |
43 | echo "cdrom${i} cdroms/cdrom`get_dev_number ${DEVICE} cdrom`" |
44 | fi |
45 | fi |
46 |
Properties
Name | Value |
---|---|
svn:executable | * |