1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-18 05:21:47 +03:00
mobile-nixos/boot/init/tasks/udev.rb

39 lines
846 B
Ruby
Raw Normal View History

2019-12-23 07:26:46 +03:00
# Runs udev daemon
class Tasks::UDev < SingletonTask
def initialize()
add_dependency(:Target, :Environment)
add_dependency(:Mount, "/dev")
add_dependency(:Mount, "/proc")
2019-12-24 01:43:22 +03:00
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)
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