summaryrefslogtreecommitdiff
path: root/aports/busybox/mdev.initd
blob: 630d83777d61314f47cf2ecdf33c02cc54b23551 (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
39
40
#!/sbin/openrc-run

description="the mdev device manager"

depend() {
	provide dev
	need sysfs dev-mount
	before checkfs fsck
	keyword -containers -vserver -lxc
}

_start_service () {
	ebegin "Starting busybox mdev"
	mkdir -p /dev
	echo "/sbin/mdev" > /proc/sys/kernel/hotplug
	eend $?
}

_start_coldplug () {
	ebegin "Scanning hardware for mdev"
	# mdev -s will not create /dev/usb[1-9] devices with recent kernels
	# so we manually trigger events for usb
	for i in $(find /sys/devices -name 'usb[0-9]*'); do
		[ -e $i/uevent ] && echo add > $i/uevent
	done
	# trigger the rest of the coldplug
	mdev -s
	eend $?
}

start() {
	_start_service
	_start_coldplug
}

stop() {
	ebegin "Stopping busybox mdev"
	echo > /proc/sys/kernel/hotplug
	eend 
}