mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-12-18 05:21:47 +03:00
35 lines
671 B
Ruby
35 lines
671 B
Ruby
# Runs udev daemon
|
|
class Tasks::UDev < SingletonTask
|
|
def initialize()
|
|
add_dependency(:SingletonTask, :Environment)
|
|
add_dependency(:Mount, "/dev")
|
|
add_dependency(:Mount, "/proc")
|
|
add_dependency(:Mount, "/run")
|
|
add_dependency(:Mount, "/sys")
|
|
end
|
|
|
|
def udevadm(*args)
|
|
System.run("udevadm", *args)
|
|
end
|
|
|
|
def run()
|
|
udevd
|
|
udevadm("trigger", "--action=add")
|
|
udevadm("settle")
|
|
end
|
|
|
|
def udevd()
|
|
*args = []
|
|
args << "--debug" if debug?
|
|
System.run("systemd-udevd", "--daemon", *args)
|
|
end
|
|
|
|
# TODO: Allow configuring its debug state
|
|
def debug?
|
|
false
|
|
end
|
|
|
|
# TODO: teardown
|
|
# udevadm control --exit
|
|
end
|