Followup from previous patch - we can now centralize the sysroot loading.
Besides the obvious cleanup value, this is also prep for dropping an
`ostree_sysroot_get_path()` user.
Closes: #1123
Approved by: jlebon
&sysroot, cancellable, error))
goto out;
- if (!ostree_sysroot_load (sysroot, cancellable, error))
- goto out;
-
if (!ostree_sysroot_cleanup (sysroot, cancellable, error))
goto out;
const char *refspec = argv[1];
- if (!ostree_sysroot_load (sysroot, cancellable, error))
- return FALSE;
OstreeRepo *repo = ostree_sysroot_repo (sysroot);
/* Find the currently booted deployment, if any; we will ensure it
OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER | OSTREE_ADMIN_BUILTIN_FLAG_UNLOCKED,
&sysroot, cancellable, error))
goto out;
-
- if (!ostree_sysroot_load (sysroot, cancellable, error))
- goto out;
if (!ot_admin_require_booted_deployment_or_osname (sysroot, opt_osname,
cancellable, error))
if (argc > 3)
branch = argv[3];
- if (!ostree_sysroot_load (sysroot, cancellable, error))
- goto out;
-
if (!ostree_sysroot_get_repo (sysroot, &repo, cancellable, error))
goto out;
&sysroot, cancellable, error))
goto out;
- if (!ostree_sysroot_load (sysroot, cancellable, error))
- goto out;
-
if (!ostree_sysroot_get_repo (sysroot, &repo, cancellable, error))
goto out;
const char *new_provided_refspec = argv[1];
- if (!ostree_sysroot_load (sysroot, cancellable, error))
- return FALSE;
-
g_autoptr(OstreeSysrootUpgrader) upgrader =
ostree_sysroot_upgrader_new_for_os_with_flags (sysroot, opt_osname,
OSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED,
return FALSE;
}
- if (!ostree_sysroot_load (sysroot, cancellable, error))
- return FALSE;
current_deployments = ostree_sysroot_get_deployments (sysroot);
deploy_index_str = argv[1];
goto out;
}
- if (!ostree_sysroot_load (sysroot, cancellable, error))
- goto out;
-
booted_deployment = ostree_sysroot_get_booted_deployment (sysroot);
if (!booted_deployment)
{
return FALSE;
}
- if (!ostree_sysroot_load (sysroot, cancellable, error))
- return FALSE;
-
g_autoptr(OstreeSysrootUpgrader) upgrader =
ostree_sysroot_upgrader_new_for_os (sysroot, opt_osname,
cancellable, error);
&sysroot, cancellable, error))
goto out;
- if (!ostree_sysroot_load (sysroot, cancellable, error))
- goto out;
-
if (argc >= 2)
{
bootversion = (guint) g_ascii_strtoull (argv[1], NULL, 10);
&sysroot, cancellable, error))
goto out;
- if (!ostree_sysroot_load (sysroot, cancellable, error))
- goto out;
-
deployments = ostree_sysroot_get_deployments (sysroot);
if (deployments->len == 0)
{
&sysroot, cancellable, error))
goto out;
- if (!ostree_sysroot_load (sysroot, cancellable, error))
- goto out;
-
deployments = ostree_sysroot_get_deployments (sysroot);
if (deployments->len == 0)
{
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);
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");
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);