implement /proc hotplugger
This commit is contained in:
parent
888cf4d878
commit
be2df26e38
@ -25,7 +25,7 @@ Dependencies
|
|||||||
- Optional
|
- Optional
|
||||||
* `blkid`
|
* `blkid`
|
||||||
- Required for UUID, LABEL, PARTUUID support
|
- Required for UUID, LABEL, PARTUUID support
|
||||||
* `mdev` OR `mdevd` OR `eudev` OR `systemd-udevd`
|
* `mdev` OR `mdevd` OR `eudev` OR `systemd-udevd` OR CONFIG_UEVENT_HELPER
|
||||||
- systemd-udevd not tested
|
- systemd-udevd not tested
|
||||||
* `lvm2`
|
* `lvm2`
|
||||||
- Required for LVM support
|
- Required for LVM support
|
||||||
|
5
config
5
config
@ -46,7 +46,10 @@
|
|||||||
#root_opts=""
|
#root_opts=""
|
||||||
|
|
||||||
# device manager
|
# device manager
|
||||||
# supported - udev, mdev, mdevd
|
#
|
||||||
|
# supported - none, proc, udev, mdev, mdevd
|
||||||
|
# none means no device manager. requires monolithic kernel and you will unable to use UUID, LABEL, PARTUUID, /dev/mapper/*
|
||||||
|
# proc requires monolithic kernel and legacy CONFIG_UEVENT_HELPER
|
||||||
#
|
#
|
||||||
#devmgr=""
|
#devmgr=""
|
||||||
|
|
||||||
|
14
init
14
init
@ -91,6 +91,16 @@ setup_devmgr()
|
|||||||
[ "$break" = devmgr ] && { print "break before setup_devmgr()"; sh; }
|
[ "$break" = devmgr ] && { print "break before setup_devmgr()"; sh; }
|
||||||
|
|
||||||
case "$devmgr" in
|
case "$devmgr" in
|
||||||
|
proc)
|
||||||
|
command -v device-helper > /proc/sys/kernel/hotplug
|
||||||
|
|
||||||
|
# get ready for fork bomb. kek
|
||||||
|
find /sys/devices -name uevent |
|
||||||
|
|
||||||
|
while read -r uevent; do
|
||||||
|
printf add > "$uevent"
|
||||||
|
done
|
||||||
|
;;
|
||||||
udev)
|
udev)
|
||||||
udevd -N never & devmgr_pid="$!"
|
udevd -N never & devmgr_pid="$!"
|
||||||
udevadm trigger -c add -t subsystems
|
udevadm trigger -c add -t subsystems
|
||||||
@ -133,7 +143,9 @@ boot_system()
|
|||||||
{
|
{
|
||||||
[ "$break" = boot ] && { print "break before boot_system()"; sh; }
|
[ "$break" = boot ] && { print "break before boot_system()"; sh; }
|
||||||
|
|
||||||
kill "$devmgr_pid"
|
{
|
||||||
|
kill "$devmgr_pid" || printf '\n' > /proc/sys/kernel/hotplug
|
||||||
|
} 2> /dev/null || :
|
||||||
|
|
||||||
# temporary workaround until util-linux release a new version
|
# temporary workaround until util-linux release a new version
|
||||||
# see https://github.com/karelzak/util-linux/issues/997
|
# see https://github.com/karelzak/util-linux/issues/997
|
||||||
|
@ -364,9 +364,8 @@ copy_devmgr()
|
|||||||
# false positive
|
# false positive
|
||||||
# shellcheck disable=2016
|
# shellcheck disable=2016
|
||||||
case "$devmgr" in
|
case "$devmgr" in
|
||||||
none)
|
proc)
|
||||||
# TODO implement mode without device manager using deprecated
|
copy_binary find
|
||||||
# /sys/kernel/uevent_helper or /proc/sys/kernel/hotplug
|
|
||||||
;;
|
;;
|
||||||
mdev)
|
mdev)
|
||||||
for _binary in mdev find; do
|
for _binary in mdev find; do
|
||||||
|
Loading…
Reference in New Issue
Block a user