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 Jun 30, 2022
1 parent 4375151 commit 4222aff
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/libostree/ostree-sysroot-deploy.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,20 @@ checkout_deployment_tree (OstreeSysroot *sysroot,
cancellable, error))
return FALSE;

/* 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;

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

0 comments on commit 4222aff

Please sign in to comment.