Now that we are no longer unconditionally opting out of getting terminated,
we get send a SIGTERM when transitioning from the rootfs back to the initrd
on poweroff/reboot.
Catch this SIGTERM and then exit cleanly by calling the on_quit handler,
besides exiting cleanly being the right thing to do, this will also allow the
boot-splash to go idle, so that it can cleanly finish the end-animation.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
raise (signum);
}
+static void
+on_term_signal (state_t *state)
+{
+ bool retain_splash = false;
+
+ ply_trace ("received SIGTERM");
+
+ on_quit (state, retain_splash, ply_trigger_new (NULL));
+}
+
static void
write_pid_file (const char *filename)
{
access ("/etc/initrd-release", F_OK) >= 0)
argv[0][0] = '@';
+ /* Catch SIGTERM for clean shutdown on poweroff/reboot */
+ ply_event_loop_watch_signal (state.loop, SIGTERM,
+ (ply_event_handler_t) on_term_signal, &state);
+
state.boot_server = start_boot_server (&state);
if (state.boot_server == NULL) {