--- extras/scsi-devfs.sh.orig 2005-02-14 20:15:04.476440488 +0100 +++ extras/scsi-devfs.sh 2005-02-14 21:56:12.230001736 +0100 @@ -13,6 +13,17 @@ # BUS="scsi", KERNEL="st*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh st %b %n", NAME="%c{1}", SYMLINK="%c{2} %k %c{3} %c{4}" # BUS="scsi", KERNEL="sg*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh sg %b %n", NAME="%c{1}", SYMLINK="%c{2} %k %c{3} %c{4}" + +# as /usr may not be present, we need a fix for /usr/bin/readlink +get_symlink() +{ + test -e $1 || return; + + if [ -h $1 ]; then + basename "`ls -og $1 | cut -d\" \" -f9`" + fi +} + # Find out where sysfs is mounted. Exit if not available sysfs=`grep -F sysfs /proc/mounts | awk '{print $2}'` if [ "$sysfs" = "" ]; then @@ -63,7 +74,7 @@ l_log="scsi/host$scsi_host/$l_com" s_log="$1/c${scsi_host}${s_com}" -readlink $2 | grep -F -q pci +get_symlink $2 | grep -F -q pci if [ "$?" != "0" ]; then # Not a PCI controller, show logical locations only echo $l_log $s_log @@ -71,7 +82,7 @@ fi # Extract PCI address -tmp=`readlink $2 | sed -e 's@/host.*/.*@@'` +tmp=`get_symlink $2 | sed -e 's@/host.*/.*@@'` pci_addr=`basename "$tmp"` pci_domain=`echo $pci_addr | cut -f 1 -d:` pci_bus=`echo $pci_addr | cut -f 2 -d:`