Skip to content

Commit

Permalink
deploy: Write a .ostree.cfs composefs image in the deploy dir
Browse files Browse the repository at this point in the history
This can be used as a composefs source for the root fs instead of
the checkout by pointing the basedir to /ostree/repo/objects.

We enable ensure_rootfs_dirs which adds the required root dirs
to the image. In particular, this includes /etc which often
isn't in ostree commits in use.

Note: This doesn't yet enable fsverity for the images.
  • Loading branch information
alexlarsson committed Apr 27, 2023
1 parent 04d3092 commit 86fb03c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/libostree/ostree-sysroot-deploy.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,22 @@ checkout_deployment_tree (OstreeSysroot *sysroot,
cancellable, error))
return FALSE;

#ifdef HAVE_COMPOSEFS
/* Create a composefs image and put in deploy dir as .ostree.cfs */
OstreeRepoCheckoutComposefsOptions composefs_opts = { 0 };
g_autoptr(OstreeComposefsTarget) target = ostree_composefs_target_new ();

composefs_opts.ensure_rootfs_dirs = TRUE;
if (!ostree_repo_checkout_composefs (repo, &composefs_opts, target, csum,
cancellable, error))
return FALSE;

g_autofree char *composefs_cfs_path = g_strdup_printf("%s/.ostree.cfs", checkout_target_name);
if (!ostree_composefs_target_write_at (target, osdeploy_dfd, composefs_cfs_path, NULL,
cancellable, error))
return FALSE;
#endif

return glnx_opendirat (osdeploy_dfd, checkout_target_name, TRUE, out_deployment_dfd,
error);
}
Expand Down

0 comments on commit 86fb03c

Please sign in to comment.