2019-12-23 06:32:34 +03:00
|
|
|
# Adds a minimal set of files required for logging-in.
|
2020-10-27 08:26:09 +03:00
|
|
|
class Tasks::Splash < SingletonTask
|
|
|
|
def initialize()
|
2019-12-28 04:43:28 +03:00
|
|
|
add_dependency(:Target, :Graphics)
|
2020-10-27 08:26:09 +03:00
|
|
|
add_dependency(:Task, Tasks::ProgressSocket.instance)
|
2019-12-23 06:32:34 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
def run()
|
2020-10-27 08:26:09 +03:00
|
|
|
args = []
|
|
|
|
if LOG_LEVEL == Logger::DEBUG
|
|
|
|
args << "--verbose"
|
|
|
|
end
|
|
|
|
|
2019-12-24 09:48:24 +03:00
|
|
|
begin
|
2020-10-27 08:26:09 +03:00
|
|
|
@pid = System.spawn(LOADER, "/applets/boot-splash.mrb", *args)
|
2020-03-10 00:34:31 +03:00
|
|
|
# Don't fail the boot if the splash fails
|
2019-12-24 09:48:24 +03:00
|
|
|
rescue System::CommandError
|
|
|
|
end
|
2019-12-23 06:32:34 +03:00
|
|
|
end
|
|
|
|
|
2019-12-28 04:56:56 +03:00
|
|
|
def ux_priority()
|
|
|
|
-100
|
|
|
|
end
|
2020-10-27 08:26:09 +03:00
|
|
|
|
|
|
|
# Implementation details-y; ask for the splash applet to be exited.
|
|
|
|
def quit(reason)
|
2020-10-31 23:51:10 +03:00
|
|
|
# Ensures the progress is shown
|
|
|
|
Progress.update({progress: 100, label: reason})
|
|
|
|
|
|
|
|
# Command it to quit
|
|
|
|
Progress.update({command: {name: "quit"}})
|
|
|
|
|
2020-10-27 08:26:09 +03:00
|
|
|
# Ensures that if for any reason the splash didn't start in time for the
|
|
|
|
# socket to listen to this message, that we'll be quitting it.
|
|
|
|
loop do
|
2020-10-31 23:51:10 +03:00
|
|
|
# Repeatedly send the current state (which has the quit command).
|
|
|
|
Progress.send_state()
|
2020-10-27 08:26:09 +03:00
|
|
|
# If it has quit, break out!
|
|
|
|
break if Process.wait(@pid, Process::WNOHANG)
|
|
|
|
|
|
|
|
# Leave some breathing room to the CPU!
|
|
|
|
sleep(0.1)
|
|
|
|
end
|
|
|
|
end
|
2019-12-23 06:32:34 +03:00
|
|
|
end
|