1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-15 19:23:01 +03:00
mobile-nixos/examples/target-disk-mode/gui-task.rb
Samuel Dionne-Riel 0fe8fa0ee2 examples/target-disk-mode: Split GUI task from configuration
There was no need to keep it there. Came from the `examples/hello` GUI
task, which in turn I *think* that in the past used a variable
interpolation.

We don't need any of that.
2021-01-05 16:29:48 -05:00

39 lines
1.1 KiB
Ruby

class Tasks::RunGui < SingletonTask
def initialize()
add_dependency(:Target, :Graphics)
add_dependency(:Mount, "/run")
add_dependency(:Files, "/dev/input")
# Ensures networking and SSH works
add_dependency(:Target, :Networking)
add_dependency(:Task, Tasks::DropbearSSHD.instance)
# Ensure this runs before SwitchRoot happens.
# Otherwise this could never be ran!
Tasks::SwitchRoot.instance.add_dependency(:Task, self)
add_dependency(:Task, Tasks::SetupGadgetMode.instance)
# Ensure shell runs once before.
if Tasks.const_defined?(:RunShell)
add_dependency(:Task, Tasks::RunShell.instance)
Tasks::RunShell.instance.add_dependency(
:Task,
Tasks::SetupGadgetMode.instance
)
end
end
def run()
System.run(LOADER, "/applets/tdm-gui.mrb")
# This `raise` shouldn't really happen as `System#run` will raise
# if the program exits non-zero.
# Though, let's nor fail in weird ways, let's be explicit.
raise "Target Disk Mode GUI exited."
end
def ux_priority()
-10000
end
end