1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-17 04:51:31 +03:00
mobile-nixos/boot/init/tasks/udev.rb
Samuel Dionne-Riel bdee7cf0e0 boot/init: Removes SingletonTask special dependency
Instead, rely on targets.

Additionally removes the "Boot" special dependency which only made sense
when it was expected that having no dependency was an error.
2020-02-03 16:19:10 -05:00

39 lines
846 B
Ruby

# Runs udev daemon
class Tasks::UDev < SingletonTask
def initialize()
add_dependency(:Target, :Environment)
add_dependency(:Mount, "/dev")
add_dependency(:Mount, "/proc")
add_dependency(:Mount, "/run")
add_dependency(:Mount, "/sys")
# Make the Devices target depend on this task.
# It is preferred to depend on the specific device rather than this target.
Targets[:Devices].add_dependency(:Task, self)
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