summaryrefslogtreecommitdiffstats
path: root/init.d/hwdrivers
blob: e44be6f01354ea22837849ac720030be2c8d9f83 (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
#!/sbin/runscript

depend() {
	before checkfs fsck
	keyword novserver
}

# Load hardware drivers
start() {
	# check for boot option "nocoldplug"
	for i in `cat /proc/cmdline 2>/dev/null`; do
		case $i in
			modules=*)
				MODULES="$MODULES `echo ${i#modules=} | tr ',' ' '`";;
			noautodetect)
				AUTODETECT=no;;
		esac
	done
	
	if [ "$MODULES" ]; then
		ebegin "Loading boot drivers"
		modprobe -a $MODULES 2> /dev/null
		eend $?
	fi

	if [ "$AUTODETECT" != no ] ; then
		ebegin "Loading hardware drivers"
		# first run we find the controllers 
		# second we find the discs
		find /sys -name modalias | xargs sort -u \
			| xargs modprobe -a  2> /dev/null
		find /sys -name modalias | xargs sort -u \
			| xargs modprobe -a 2> /dev/null
	fi
	eend 0
}