Jim Gifford wrote:
> Archaic and all I came around an interesting way to fix the cd-symlink
> issue, without having to use the script that is in LFS.org repo. Just
> passing on the information I just learned hopefully it will be useful to
> someone. These new rules are in the udev-cross-lfs packages as of today,
> if you want to test them out.
> 
> For SCSI
> 
> BUS=="scsi",    KERNEL=="sr[0-9]*", ACTION=="add", IMPORT="cdrom_id
> --export $tempnode"
> BUS=="scsi",    KERNEL="scd[a-z]", ACTION=="add", IMPORT="cdrom_id
> --export $tempnode"
> BUS=="scsi",    KERNEL=="sg[0-9]*", ACTION=="add", DRIVER=="sr",
> GROUP="cdrom"
> 
> BUS=="scsi", ENV{ID_CDROM}=="?*",       SYMLINK+="cdrom%n", GROUP="cdrom"

I'm by no means an expert here, but does the GROUP do anything for a
symlink that has 777 permissions?  Or does that apply to the name when
the actual device is created?

> BUS=="scsi", ENV{ID_CDROM_CD_R}=="?*",  SYMLINK+="cdr%n"
> BUS=="scsi", ENV{ID_CDROM_CD_RW}=="?*", SYMLINK+="cdrw%n"
> BUS=="scsi", ENV{ID_CDROM_DVD}=="?*",   SYMLINK+="dvd%n"
> BUS=="scsi", ENV{ID_CDROM_DVD_R}=="?*", SYMLINK+="dvdrw%n"
> 
> For IDE
> 
> BUS=="ide",     KERNEL=="hd[a-z]", ACTION=="add", IMPORT="cdrom_id
> --export $tempnode"
> 
> BUS=="ide", ENV{ID_CDROM}=="?*",        PROGRAM="cdsymlink_helper.sh
> %k", SYMLINK+="cdrom%c", GROUP="cdrom"
> BUS=="ide", ENV{ID_CDROM_CD_R}=="?*",   PROGRAM="cdsymlink_helper.sh
> %k", SYMLINK+="cdr%c"
> BUS=="ide", ENV{ID_CDROM_CD_RW}=="?*",  PROGRAM="cdsymlink_helper.sh
> %k", SYMLINK+="cdrw%c"
> BUS=="ide", ENV{ID_CDROM_DVD}=="?*",    PROGRAM="cdsymlink_helper.sh
> %k", SYMLINK+="dvd%c"
> BUS=="ide", ENV{ID_CDROM_DVD_R}=="?*",  PROGRAM="cdsymlink_helper.sh
> %k", SYMLINK+="dvdrw%c"
> 
> new file cdsymlink_helper
> 
> KERN_NAME="$1"
> 
> if [ "$KERN_NAME" = "" ]; then
>        mesg Bad invocation: \$1 is not set
>        exit 1
> fi
> FILES="`ls /sys/bus/ide/drivers/ide-cdrom | grep 1.`"

Isn't FILES here really a directory or directories?  Or links to
directories?

>        for file in $FILES; do
>                TEST="`ls /sys/bus/ide/drivers/ide-cdrom/$file | grep -c
> $KERN_NAME`"
>                if [ "$TEST" = "1" ]; then
>                        link="`echo $file | cut -f2 -d.`"
>                        echo $link
>                fi
>        done
> 

How robust is this?  It would seem to work if there are two cdroms, but
does it generalize to the admittedly unusual case where there are more
than two?  I'm not sure how the drives are recognized.  I only have one
and it is at "/sys/bus/ide/drivers/ide-cdrom/0.0"  What do the digits
before and after the dot stand for? bus.device as in hda => 0.0  ... hdd
=> 1.1 ?

Since my hard disk drive is sata and recognized as sda, would this work
if I have a cdrom on hda and hdb?  Hard coding the 1 doesn't seem to be
right to me.

  -- Bruce

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to