diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ostree/ot-admin-builtin-cleanup.c | 3 | ||||
-rw-r--r-- | src/ostree/ot-admin-builtin-deploy.c | 2 | ||||
-rw-r--r-- | src/ostree/ot-admin-builtin-diff.c | 3 | ||||
-rw-r--r-- | src/ostree/ot-admin-builtin-set-origin.c | 3 | ||||
-rw-r--r-- | src/ostree/ot-admin-builtin-status.c | 3 | ||||
-rw-r--r-- | src/ostree/ot-admin-builtin-switch.c | 3 | ||||
-rw-r--r-- | src/ostree/ot-admin-builtin-undeploy.c | 2 | ||||
-rw-r--r-- | src/ostree/ot-admin-builtin-unlock.c | 3 | ||||
-rw-r--r-- | src/ostree/ot-admin-builtin-upgrade.c | 3 | ||||
-rw-r--r-- | src/ostree/ot-admin-instutil-builtin-grub2-generate.c | 3 | ||||
-rw-r--r-- | src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c | 3 | ||||
-rw-r--r-- | src/ostree/ot-admin-instutil-builtin-set-kargs.c | 3 | ||||
-rw-r--r-- | src/ostree/ot-main.c | 20 |
13 files changed, 10 insertions, 44 deletions
diff --git a/src/ostree/ot-admin-builtin-cleanup.c b/src/ostree/ot-admin-builtin-cleanup.c index 13caa7f4..a3b0a880 100644 --- a/src/ostree/ot-admin-builtin-cleanup.c +++ b/src/ostree/ot-admin-builtin-cleanup.c @@ -52,9 +52,6 @@ ot_admin_builtin_cleanup (int argc, char **argv, GCancellable *cancellable, GErr &sysroot, cancellable, error)) goto out; - if (!ostree_sysroot_load (sysroot, cancellable, error)) - goto out; - if (!ostree_sysroot_cleanup (sysroot, cancellable, error)) goto out; diff --git a/src/ostree/ot-admin-builtin-deploy.c b/src/ostree/ot-admin-builtin-deploy.c index fa588f87..e46ad025 100644 --- a/src/ostree/ot-admin-builtin-deploy.c +++ b/src/ostree/ot-admin-builtin-deploy.c @@ -82,8 +82,6 @@ ot_admin_builtin_deploy (int argc, char **argv, GCancellable *cancellable, GErro 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 diff --git a/src/ostree/ot-admin-builtin-diff.c b/src/ostree/ot-admin-builtin-diff.c index 0419f2e1..99672866 100644 --- a/src/ostree/ot-admin-builtin-diff.c +++ b/src/ostree/ot-admin-builtin-diff.c @@ -63,9 +63,6 @@ ot_admin_builtin_diff (int argc, char **argv, GCancellable *cancellable, GError 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)) diff --git a/src/ostree/ot-admin-builtin-set-origin.c b/src/ostree/ot-admin-builtin-set-origin.c index c49f575a..e6020cbe 100644 --- a/src/ostree/ot-admin-builtin-set-origin.c +++ b/src/ostree/ot-admin-builtin-set-origin.c @@ -75,9 +75,6 @@ ot_admin_builtin_set_origin (int argc, char **argv, GCancellable *cancellable, G 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; diff --git a/src/ostree/ot-admin-builtin-status.c b/src/ostree/ot-admin-builtin-status.c index 3dd7aec5..56107974 100644 --- a/src/ostree/ot-admin-builtin-status.c +++ b/src/ostree/ot-admin-builtin-status.c @@ -108,9 +108,6 @@ ot_admin_builtin_status (int argc, char **argv, GCancellable *cancellable, GErro &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; diff --git a/src/ostree/ot-admin-builtin-switch.c b/src/ostree/ot-admin-builtin-switch.c index 3b54ea85..48fb2726 100644 --- a/src/ostree/ot-admin-builtin-switch.c +++ b/src/ostree/ot-admin-builtin-switch.c @@ -63,9 +63,6 @@ ot_admin_builtin_switch (int argc, char **argv, GCancellable *cancellable, GErro 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, diff --git a/src/ostree/ot-admin-builtin-undeploy.c b/src/ostree/ot-admin-builtin-undeploy.c index c0ff89ef..d16c927e 100644 --- a/src/ostree/ot-admin-builtin-undeploy.c +++ b/src/ostree/ot-admin-builtin-undeploy.c @@ -60,8 +60,6 @@ ot_admin_builtin_undeploy (int argc, char **argv, GCancellable *cancellable, GEr return FALSE; } - if (!ostree_sysroot_load (sysroot, cancellable, error)) - return FALSE; current_deployments = ostree_sysroot_get_deployments (sysroot); deploy_index_str = argv[1]; diff --git a/src/ostree/ot-admin-builtin-unlock.c b/src/ostree/ot-admin-builtin-unlock.c index 05397414..36d99edb 100644 --- a/src/ostree/ot-admin-builtin-unlock.c +++ b/src/ostree/ot-admin-builtin-unlock.c @@ -65,9 +65,6 @@ ot_admin_builtin_unlock (int argc, char **argv, GCancellable *cancellable, GErro goto out; } - if (!ostree_sysroot_load (sysroot, cancellable, error)) - goto out; - booted_deployment = ostree_sysroot_get_booted_deployment (sysroot); if (!booted_deployment) { diff --git a/src/ostree/ot-admin-builtin-upgrade.c b/src/ostree/ot-admin-builtin-upgrade.c index 77be95d2..8944904b 100644 --- a/src/ostree/ot-admin-builtin-upgrade.c +++ b/src/ostree/ot-admin-builtin-upgrade.c @@ -78,9 +78,6 @@ ot_admin_builtin_upgrade (int argc, char **argv, GCancellable *cancellable, GErr 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); diff --git a/src/ostree/ot-admin-instutil-builtin-grub2-generate.c b/src/ostree/ot-admin-instutil-builtin-grub2-generate.c index 07bd1eaa..8ff0dc47 100644 --- a/src/ostree/ot-admin-instutil-builtin-grub2-generate.c +++ b/src/ostree/ot-admin-instutil-builtin-grub2-generate.c @@ -53,9 +53,6 @@ ot_admin_instutil_builtin_grub2_generate (int argc, char **argv, GCancellable *c &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); diff --git a/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c b/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c index c754b18a..cbca7db3 100644 --- a/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c +++ b/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c @@ -204,9 +204,6 @@ ot_admin_instutil_builtin_selinux_ensure_labeled (int argc, char **argv, GCancel &sysroot, cancellable, error)) goto out; - if (!ostree_sysroot_load (sysroot, cancellable, error)) - goto out; - deployments = ostree_sysroot_get_deployments (sysroot); if (deployments->len == 0) { diff --git a/src/ostree/ot-admin-instutil-builtin-set-kargs.c b/src/ostree/ot-admin-instutil-builtin-set-kargs.c index 1a37022c..7a98feb7 100644 --- a/src/ostree/ot-admin-instutil-builtin-set-kargs.c +++ b/src/ostree/ot-admin-instutil-builtin-set-kargs.c @@ -66,9 +66,6 @@ ot_admin_instutil_builtin_set_kargs (int argc, char **argv, GCancellable *cancel &sysroot, cancellable, error)) goto out; - if (!ostree_sysroot_load (sysroot, cancellable, error)) - goto out; - deployments = ostree_sysroot_get_deployments (sysroot); if (deployments->len == 0) { 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); |