aports/main/busybox/mdev.initd
Laurent Bercot 8262f47378 main/busybox: gather all subpackages under one APKBUILD
As requested, busybox-openrc, busybox-mdev-openrc and
busybox-extras-openrc are not defined in separate
packages, but are now all subpackages of busybox.
Thanks to psykose for the mention of amove!

Signed-off-by: Laurent Bercot <ska@appnovation.com>
2022-09-04 05:49:07 +00:00

41 lines
745 B
Bash

#!/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
}