Well, after the previous discussions on how to find CD-ROMs, I figured I'd
post what I finally came up with.  It works with IDE and SCSI CD's, which is
all I have to test with.  It works correctly if there is more than one CD
present.  It probably doesn't work with the old propriatery interface CD
drives.

no sed, no grep, nuttin' but sh...

# Locate an IDE or SSCI CD-ROM drive

unset CDDEV

for file in /proc/ide/hd?/media /proc/scsi/scsi; do
        [ -r $file ] || continue
        while read line ; do
                case $line in
                *CD-ROM*|*cdrom*)
                        CDDEV=${file#/proc/*/}
                        CDDEV=${CDDEV%/media}
                        [ "$CDDEV" = "scsi" ] && CDDEV=scd0
                        break 2
                        ;;
                esac
        done <$file
done

[ -n "$CDDEV" ] && ln -sf /dev/$CDDEV /dev/cdrom

Charles Steinkuehler
http://lrp.steinkuehler.net
http://c0wz.steinkuehler.net (lrp.c0wz.com mirror)



_______________________________________________
Leaf-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-devel

Reply via email to