aboutsummaryrefslogtreecommitdiffstats
path: root/main/openrc/hwdrivers.initd
blob: 2efe52a4a66488aae21aa4713497e5eb5ca82f5e (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
#!/sbin/openrc-run

depend() {
	need sysfs dev
	before checkfs fsck
	after modloop
	keyword novserver
}

# Load hardware drivers
start() {
	# check for boot option "nocoldplug"
	if get_bootparam noautodetect; then
		ewarn "Autodetection of hardware disabled from boot cmdline"
		return 0
	fi

	ebegin "Loading hardware drivers"
	find /sys -name modalias -type f -print0 | xargs -0 sort -u \
		| xargs modprobe -b -a 2> /dev/null
	# we run it twice so we detect all devices
	find /sys -name modalias -type f -print0 | xargs -0 sort -u \
		| xargs modprobe -b -a 2> /dev/null

	# check if framebuffer drivers got pulled in
	if [ -e /sys/module/fb ] && ! [ -e /sys/module/fbcon ]; then
		modprobe fbcon
	fi

	eend 0
}