chiark / gitweb /
[PATCH] update udev scsi_id to scsi_id 0.5
[elogind.git] / extras / ide-devfs.sh
index 0a9369dff4aa17f74535616823a0d2e171550a0b..4d021c5e8723ccd18554c127b7c91a3ed107e5f2 100644 (file)
@@ -8,7 +8,7 @@ HOST="${2%\.[0-9]}"
 TARGET="${2#[0-9]\.}"
 
 if [ -z "${HOST#[13579]}" ]; then
-       HOST=`expr ${HOST} - 1`
+       HOST=$((${HOST} - 1))
        BUS="1"
 else
        BUS="0"
@@ -24,7 +24,7 @@ get_dev_number() {
                if [ -e "${x}" ]; then
                        MEDIA=`cat ${x}`
                        if [ "${MEDIA}" = "$2" ]; then
-                               num=`expr ${num} + 1`
+                               num=$((${num} + 1))
                        fi
                        if [ "${x}" = "/proc/ide/${DRIVE}/media" ]; then
                                break
@@ -32,13 +32,15 @@ get_dev_number() {
                fi
        done
        
-       echo `expr ${num} - 1`
+       echo $((${num} - 1))
 }
 
-if [ -z "$3" ]; then
+if [ -z "$3" -a -f /proc/ide/${1}/media ]; then
        MEDIA=`cat /proc/ide/${1}/media`
        if [ "${MEDIA}" = "cdrom" ]; then
                echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/cd cdroms/cdrom`get_dev_number $1 cdrom`
+       elif [ "${MEDIA}" = "floppy" ]; then
+               echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc floppies/floppy`get_dev_number $1 floppy`/disc
        elif [ "${MEDIA}" = "disk" ]; then
                echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc discs/disc`get_dev_number $1 disk`/disc
        fi