2019-12-23 07:26:46 +03:00
|
|
|
# Runs udev daemon
|
|
|
|
class Tasks::UDev < SingletonTask
|
|
|
|
def initialize()
|
|
|
|
add_dependency(:SingletonTask, :Environment)
|
2019-12-23 22:48:22 +03:00
|
|
|
add_dependency(:Mount, "/dev")
|
|
|
|
add_dependency(:Mount, "/proc")
|
2019-12-24 01:43:22 +03:00
|
|
|
add_dependency(:Mount, "/run")
|
|
|
|
add_dependency(:Mount, "/sys")
|
2019-12-23 07:26:46 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
def udevadm(*args)
|
|
|
|
System.run("udevadm", *args)
|
|
|
|
end
|
|
|
|
|
|
|
|
def run()
|
2019-12-23 22:00:39 +03:00
|
|
|
udevd
|
2019-12-23 07:26:46 +03:00
|
|
|
udevadm("trigger", "--action=add")
|
|
|
|
udevadm("settle")
|
|
|
|
end
|
|
|
|
|
2019-12-23 22:00:39 +03:00
|
|
|
def udevd()
|
|
|
|
*args = []
|
|
|
|
args << "--debug" if debug?
|
|
|
|
System.run("systemd-udevd", "--daemon", *args)
|
|
|
|
end
|
|
|
|
|
|
|
|
# TODO: Allow configuring its debug state
|
|
|
|
def debug?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
2019-12-23 07:26:46 +03:00
|
|
|
# TODO: teardown
|
|
|
|
# udevadm control --exit
|
|
|
|
end
|