diff options
author | Colin Walters <walters@verbum.org> | 2014-01-19 11:28:30 -0500 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2014-01-19 11:28:30 -0500 |
commit | d98eb901c4cf5b923a163aefdef0cdf1075af621 (patch) | |
tree | f82178cf68f4a0779d1f460ff4b9809333771db3 /src/ostree/ot-admin-builtin-upgrade.c | |
parent | 1a20ab44201b529d757f27164323c3036e5a5dd6 (diff) | |
download | ostree-d98eb901c4cf5b923a163aefdef0cdf1075af621.tar.gz |
deploy/main: Unify some bits between admin-switch and admin-upgrade
Diffstat (limited to 'src/ostree/ot-admin-builtin-upgrade.c')
-rw-r--r-- | src/ostree/ot-admin-builtin-upgrade.c | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/src/ostree/ot-admin-builtin-upgrade.c b/src/ostree/ot-admin-builtin-upgrade.c index d222e9e0..1b86cddc 100644 --- a/src/ostree/ot-admin-builtin-upgrade.c +++ b/src/ostree/ot-admin-builtin-upgrade.c @@ -67,38 +67,14 @@ ot_admin_builtin_upgrade (int argc, char **argv, OstreeSysroot *sysroot, GCancel if (!ostree_sysroot_load (sysroot, cancellable, error)) goto out; - if (!ot_admin_require_booted_deployment_or_osname (sysroot, opt_osname, - cancellable, error)) - goto out; - merge_deployment = ostree_sysroot_get_merge_deployment (sysroot, opt_osname); - if (merge_deployment == NULL) - { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "No previous deployment for OS '%s'", opt_osname); - goto out; - } - - deployment_path = ostree_sysroot_get_deployment_directory (sysroot, merge_deployment); - deployment_origin_path = ostree_sysroot_get_deployment_origin_path (deployment_path); if (!ostree_sysroot_get_repo (sysroot, &repo, cancellable, error)) goto out; - origin = ostree_deployment_get_origin (merge_deployment); - if (!origin) - { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "No origin known for current deployment"); - goto out; - } - origin_refspec = g_key_file_get_string (origin, "origin", "refspec", NULL); - if (!origin_refspec) - { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "No origin/refspec in current deployment origin; cannot upgrade via ostree"); - goto out; - } - if (!ostree_parse_refspec (origin_refspec, &origin_remote, &origin_ref, error)) + if (!ot_admin_deploy_prepare (sysroot, opt_osname, &merge_deployment, + &origin_remote, &origin_ref, + &origin, + cancellable, error)) goto out; if (origin_remote) |