On Nov 26, Sam Morris <[EMAIL PROTECTED]> wrote:

> I came up with the following code that works fine in Bash, although I 
> don't know whether substring expansion is a Bash extension. It does work 
Yes, it's a bashism.

The problem is that I did not actually copy the fixed script in the
package, I am attaching it.

-- 
ciao,
Marco
#!/bin/sh -e
#
# load the high level driver for IDE devices
#

cd /lib/udev/
. ./hotplug.functions

if [ -z "$DEVPATH" ]; then
    echo "\$DEVPATH is not set!" >&2
    exit 1
fi

device=${DEVPATH#/devices/*/ide?/}
drive=${device#?.}
bus=${device%.?}

unitnum=$((96 + 1 + $drive + $bus * 2))
name=$(printf "hd\\$(printf '%o' $unitnum)")

procfile="/proc/ide/$name/media"

wait_for_file $procfile

read media < $procfile
case "$media" in
    cdrom)      module=ide-cd ;;
    disk)       module=ide-disk ;;
    floppy)     module=ide-floppy ;;
    tape)       module=ide-tape ;;
    *)          module=ide-generic ;;
esac

if [ "$module" ]; then
    exec $MODPROBE $module
fi

exit 0

Attachment: signature.asc
Description: Digital signature

Reply via email to