Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

finalize-staged: Don't listen to SIGTERM, just let kernel exit us #2704

Merged
merged 1 commit into from
Aug 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions src/ostree/ot-admin-builtin-finalize-staged.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@ static GOptionEntry options[] = {
{ NULL }
};

static gboolean
sigterm_cb (gpointer user_data)
{
gboolean *running = user_data;
g_print ("Received SIGTERM, exiting\n");
*running = FALSE;
g_main_context_wakeup (NULL);
return G_SOURCE_REMOVE;
}

/* Called by ostree-finalize-staged.service, and in turn
* invokes a cmdprivate function inside the shared library.
*/
Expand Down Expand Up @@ -94,14 +84,10 @@ ot_admin_builtin_finalize_staged (int argc, char **argv, OstreeCommandInvocation
return FALSE;

/* We want to keep /boot open until the deployment is finalized during
* system shutdown, so block on SIGTERM under the assumption that it will
* be received when systemd stops the unit.
* system shutdown, so block until we get SIGTERM which systemd will send
* when the unit is stopped.
*/
gboolean running = TRUE;
g_unix_signal_add (SIGTERM, sigterm_cb, &running);
g_print ("Waiting for SIGTERM\n");
while (running)
g_main_context_iteration (NULL, TRUE);
pause ();
}
else
{
Expand Down