File: ide.agent

package info (click to toggle)
udev 0.105-4etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 672 kB
  • ctags: 54
  • sloc: sh: 1,636; makefile: 273
file content (40 lines) | stat: -rw-r--r-- 688 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh -e
# only needed for kernels < 2.6.16
#
# 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