diff options
author | Colin Walters <walters@verbum.org> | 2015-01-16 13:04:29 -0500 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2015-01-19 13:45:11 -0500 |
commit | 886913abdc649bbf340ce8c890a517a2c9bbb6f6 (patch) | |
tree | 635ed0d2e16f7cbae89a6628841957cf1c6c5bc6 | |
parent | 1d216a8c604733bd9ac25200731ec2d8d781fe14 (diff) | |
download | ostree-886913abdc649bbf340ce8c890a517a2c9bbb6f6.tar.gz |
sysroot: Add ostree_sysroot_write_origin_file() API
We want to allow admins to change the origin file without doing a new
deployment, so this will be part of a future "admin set-origin"
command.
-rw-r--r-- | src/libostree/ostree-sysroot-deploy.c | 29 | ||||
-rw-r--r-- | src/libostree/ostree-sysroot.h | 6 |
2 files changed, 28 insertions, 7 deletions
diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index d5c6811e..b3289327 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -949,14 +949,28 @@ merge_configuration (OstreeSysroot *sysroot, return ret; } -static gboolean -write_origin_file (OstreeSysroot *sysroot, - OstreeDeployment *deployment, - GCancellable *cancellable, - GError **error) +/** + * ostree_sysroot_write_origin_file: + * @sysroot: System root + * @deployment: Deployment + * @new_origin: (allow-none): Origin content + * @cancellable: Cancellable + * @error: Error + * + * Immediately replace the origin file of the referenced @deployment + * with the contents of @new_origin. If @new_origin is %NULL, + * this function will write the current origin of @deployment. + */ +gboolean +ostree_sysroot_write_origin_file (OstreeSysroot *sysroot, + OstreeDeployment *deployment, + GKeyFile *new_origin, + GCancellable *cancellable, + GError **error) { gboolean ret = FALSE; - GKeyFile *origin = ostree_deployment_get_origin (deployment); + GKeyFile *origin = + new_origin ? new_origin : ostree_deployment_get_origin (deployment); if (origin) { @@ -1879,7 +1893,8 @@ ostree_sysroot_deploy_tree (OstreeSysroot *self, goto out; } - if (!write_origin_file (self, new_deployment, cancellable, error)) + if (!ostree_sysroot_write_origin_file (self, new_deployment, NULL, + cancellable, error)) { g_prefix_error (error, "Writing out origin file: "); goto out; diff --git a/src/libostree/ostree-sysroot.h b/src/libostree/ostree-sysroot.h index 7bfda2c8..2044b923 100644 --- a/src/libostree/ostree-sysroot.h +++ b/src/libostree/ostree-sysroot.h @@ -61,6 +61,12 @@ gboolean ostree_sysroot_cleanup (OstreeSysroot *self, GCancellable *cancellable, GError **error); +gboolean ostree_sysroot_write_origin_file (OstreeSysroot *sysroot, + OstreeDeployment *deployment, + GKeyFile *new_origin, + GCancellable *cancellable, + GError **error); + gboolean ostree_sysroot_get_repo (OstreeSysroot *self, OstreeRepo **out_repo, GCancellable *cancellable, |