summaryrefslogtreecommitdiff
path: root/scripts/init-premount/udev-helper
blob: 03a3fdfd12c46031fc3252743eacee178da76f82 (plain)
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
#!/bin/sh

PREREQ="udev"

prereqs()
{
	echo "$PREREQ"
}

case $1 in
# get pre-requisites
prereqs)
	prereqs
	exit 0
	;;
esac

modprobe -q ide-generic

[ -e /proc/ide ] || return

for drive in /proc/ide/*; do
	[ -e ${drive}/media ] || continue
	# nothing to do if the device has already been took in charge
	unit=${drive#/proc/ide/}
	[ -d /sys/block/$unit ] && continue

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

	modprobe -q ${MODULE}
done