Skip to content

Commit

Permalink
finalize-staged: Use the core option parsing to load sysroot
Browse files Browse the repository at this point in the history
Prep for using the default mount namespace handling there that
will land as part of the read-only `/sysroot` and `/boot` work.
See ostreedev#1265
  • Loading branch information
cgwalters committed Nov 8, 2019
1 parent eb05ace commit f414923
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/ostree/ot-admin-builtin-finalize-staged.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
#include "ostree-cmdprivate.h"
#include "ostree.h"

static GOptionEntry options[] = {
{ NULL }
};

/* Called by ostree-finalize-staged.service, and in turn
* invokes a cmdprivate function inside the shared library.
*/
Expand All @@ -46,11 +50,13 @@ ot_admin_builtin_finalize_staged (int argc, char **argv, OstreeCommandInvocation
if (fstatat (AT_FDCWD, "/run/ostree-booted", &stbuf, 0) < 0)
return TRUE;

g_autoptr(GFile) sysroot_file = g_file_new_for_path ("/");
g_autoptr(OstreeSysroot) sysroot = ostree_sysroot_new (sysroot_file);

if (!ostree_sysroot_load (sysroot, cancellable, error))
g_autoptr(GOptionContext) context = g_option_context_new ("");
g_autoptr(OstreeSysroot) sysroot = NULL;
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER,
invocation, &sysroot, cancellable, error))
return FALSE;

if (!ostree_cmd__private__()->ostree_finalize_staged (sysroot, cancellable, error))
return FALSE;

Expand Down

0 comments on commit f414923

Please sign in to comment.