mirror of
https://github.com/ostreedev/ostree.git
synced 2025-02-02 13:47:38 +03:00
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.
This commit is contained in:
parent
1d216a8c60
commit
886913abdc
@ -949,14 +949,28 @@ merge_configuration (OstreeSysroot *sysroot,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
/**
|
||||||
write_origin_file (OstreeSysroot *sysroot,
|
* ostree_sysroot_write_origin_file:
|
||||||
OstreeDeployment *deployment,
|
* @sysroot: System root
|
||||||
GCancellable *cancellable,
|
* @deployment: Deployment
|
||||||
GError **error)
|
* @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;
|
gboolean ret = FALSE;
|
||||||
GKeyFile *origin = ostree_deployment_get_origin (deployment);
|
GKeyFile *origin =
|
||||||
|
new_origin ? new_origin : ostree_deployment_get_origin (deployment);
|
||||||
|
|
||||||
if (origin)
|
if (origin)
|
||||||
{
|
{
|
||||||
@ -1879,7 +1893,8 @@ ostree_sysroot_deploy_tree (OstreeSysroot *self,
|
|||||||
goto out;
|
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: ");
|
g_prefix_error (error, "Writing out origin file: ");
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -61,6 +61,12 @@ gboolean ostree_sysroot_cleanup (OstreeSysroot *self,
|
|||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error);
|
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,
|
gboolean ostree_sysroot_get_repo (OstreeSysroot *self,
|
||||||
OstreeRepo **out_repo,
|
OstreeRepo **out_repo,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user