move device managers to hooks
This commit is contained in:
22
hooks/mdev/mdev
Normal file
22
hooks/mdev/mdev
Normal file
@ -0,0 +1,22 @@
|
||||
# vim: set ft=sh:
|
||||
# shellcheck shell=sh
|
||||
#
|
||||
# false positive
|
||||
# shellcheck disable=2154,2016
|
||||
#
|
||||
# handle_mdev()
|
||||
{
|
||||
print "configuring mdev"
|
||||
|
||||
for _binary in mdev find; do
|
||||
copy_binary "$_binary"
|
||||
done
|
||||
|
||||
printf "%s\n" \
|
||||
'SUBSYSTEM=block;.* 0:0 660 @device-helper' \
|
||||
> "${tmpdir}/etc/mdev.conf"
|
||||
|
||||
[ "$monolith" = 1 ] || printf "%s\n" \
|
||||
'$MODALIAS=.* 0:0 660 @modprobe "$MODALIAS"' \
|
||||
>> "${tmpdir}/etc/mdev.conf"
|
||||
}
|
19
hooks/mdev/mdev.init
Normal file
19
hooks/mdev/mdev.init
Normal file
@ -0,0 +1,19 @@
|
||||
# vim: set ft=sh:
|
||||
# shellcheck shell=sh
|
||||
#
|
||||
# false positive
|
||||
# shellcheck disable=2154,2034
|
||||
#
|
||||
# run_mdev()
|
||||
{
|
||||
[ "$break" = devmgr ] && { print "break before run_mdev()"; sh; }
|
||||
|
||||
mdev -s
|
||||
mdev -df 2> /dev/null & mdev_pid="$!"
|
||||
|
||||
find /sys/devices -name uevent |
|
||||
|
||||
while read -r uevent; do
|
||||
printf add > "$uevent"
|
||||
done 2> /dev/null
|
||||
}
|
10
hooks/mdev/mdev.init.late
Normal file
10
hooks/mdev/mdev.init.late
Normal file
@ -0,0 +1,10 @@
|
||||
# vim: set ft=sh:
|
||||
# shellcheck shell=sh
|
||||
#
|
||||
# false positive
|
||||
# shellcheck disable=2154
|
||||
#
|
||||
# stop_mdev()
|
||||
{
|
||||
kill "$mdev_pid"
|
||||
}
|
Reference in New Issue
Block a user