diff --git a/src/ostree/ot-admin-builtin-upgrade.c b/src/ostree/ot-admin-builtin-upgrade.c index 5663c4fe..1222803c 100644 --- a/src/ostree/ot-admin-builtin-upgrade.c +++ b/src/ostree/ot-admin-builtin-upgrade.c @@ -25,6 +25,7 @@ #include "ot-admin-builtins.h" #include "ot-admin-functions.h" #include "ot-admin-deploy.h" +#include "ostree-pull.h" #include "ostree.h" #include "otutil.h" @@ -118,9 +119,12 @@ ot_admin_builtin_upgrade (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, if (origin_remote) { + char *refs_to_fetch[] = { origin_ref, NULL }; + g_print ("Fetching remote %s ref %s\n", origin_remote, origin_ref); - if (!ot_admin_pull (admin_opts->sysroot, origin_remote, origin_ref, - cancellable, error)) + + if (!ostree_pull (repo, origin_remote, refs_to_fetch, OSTREE_PULL_FLAGS_NONE, + cancellable, error)) goto out; } diff --git a/src/ostree/ot-admin-functions.c b/src/ostree/ot-admin-functions.c index e97250b3..1b469ebe 100644 --- a/src/ostree/ot-admin-functions.c +++ b/src/ostree/ot-admin-functions.c @@ -776,24 +776,6 @@ ot_admin_list_deployments (GFile *sysroot, return ret; } -gboolean -ot_admin_pull (GFile *sysroot, - const char *remote, - const char *ref, - GCancellable *cancellable, - GError **error) -{ - gs_unref_object GFile *repo_path = g_file_resolve_relative_path (sysroot, "ostree/repo"); - gs_free char *repo_arg = g_strconcat ("--repo=", - gs_file_get_path_cached (repo_path), - NULL); - - return gs_subprocess_simple_run_sync (NULL, - GS_SUBPROCESS_STREAM_DISPOSITION_INHERIT, - cancellable, error, - "ostree", repo_arg, "pull", remote, ref, NULL); -} - GFile * ot_admin_get_deployment_directory (GFile *sysroot, OtDeployment *deployment) diff --git a/src/ostree/ot-admin-functions.h b/src/ostree/ot-admin-functions.h index ad2a9324..21195b56 100644 --- a/src/ostree/ot-admin-functions.h +++ b/src/ostree/ot-admin-functions.h @@ -118,12 +118,6 @@ gboolean ot_admin_get_default_ostree_dir (GFile **out_ostree_dir, GKeyFile *ot_origin_new_from_refspec (const char *refspec); -gboolean ot_admin_pull (GFile *ostree_dir, - const char *remote, - const char *ref, - GCancellable *cancellable, - GError **error); - G_END_DECLS #endif