summaryrefslogtreecommitdiff
path: root/src/ostree/ot-main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ostree/ot-main.c')
-rw-r--r--src/ostree/ot-main.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/ostree/ot-main.c b/src/ostree/ot-main.c
index 48281c26..cd7f0f4c 100644
--- a/src/ostree/ot-main.c
+++ b/src/ostree/ot-main.c
@@ -391,6 +391,16 @@ ostree_admin_option_context_parse (GOptionContext *context,
g_autoptr(OstreeSysroot) sysroot = ostree_sysroot_new (sysroot_path);
g_signal_connect (sysroot, "journal-msg", G_CALLBACK (on_sysroot_journal_msg), NULL);
+ if ((flags & OSTREE_ADMIN_BUILTIN_FLAG_UNLOCKED) == 0)
+ {
+ /* Released when sysroot is finalized, or on process exit */
+ if (!ot_admin_sysroot_lock (sysroot, error))
+ return FALSE;
+ }
+
+ if (!ostree_sysroot_load (sysroot, cancellable, error))
+ return FALSE;
+
if (flags & OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER)
{
GFile *path = ostree_sysroot_get_path (sysroot);
@@ -411,9 +421,6 @@ ostree_admin_option_context_parse (GOptionContext *context,
g_autoptr(GFile) deployment_file = NULL;
g_autofree char *deployment_path = NULL;
- if (!ostree_sysroot_load (sysroot, cancellable, error))
- return FALSE;
-
deployments = ostree_sysroot_get_deployments (sysroot);
if (deployments->len == 0)
return glnx_throw (error, "Unable to find a deployment in sysroot");
@@ -433,13 +440,6 @@ ostree_admin_option_context_parse (GOptionContext *context,
exit (EXIT_SUCCESS);
}
- if ((flags & OSTREE_ADMIN_BUILTIN_FLAG_UNLOCKED) == 0)
- {
- /* Released when sysroot is finalized, or on process exit */
- if (!ot_admin_sysroot_lock (sysroot, error))
- return FALSE;
- }
-
if (out_sysroot)
*out_sysroot = g_steal_pointer (&sysroot);