Skip to content

Commit 64a38ae

Browse files
authored
Merge pull request #3353 from jlebon/pr/composefs-maybe
libostree/deploy: enable composefs by default
2 parents 1c68410 + 41a7f36 commit 64a38ae

File tree

3 files changed

+31
-8
lines changed

3 files changed

+31
-8
lines changed

src/libostree/ostree-sysroot-deploy.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -640,9 +640,6 @@ checkout_deployment_tree (OstreeSysroot *sysroot, OstreeRepo *repo, OstreeDeploy
640640
if (!glnx_opendirat (osdeploy_dfd, checkout_target_name, TRUE, &ret_deployment_dfd, error))
641641
return FALSE;
642642

643-
guint64 composefs_start_time = 0;
644-
guint64 composefs_end_time = 0;
645-
#ifdef HAVE_COMPOSEFS
646643
/* TODO: Consider changing things in the future to parse the deployment config from memory, and
647644
* if composefs is enabled, then we can check out in "user mode" (i.e. only have suid binaries
648645
* enabled in composefs, etc.)
@@ -667,7 +664,11 @@ checkout_deployment_tree (OstreeSysroot *sysroot, OstreeRepo *repo, OstreeDeploy
667664
g_debug ("composefs enabled by config: %d repo: %d", composefs_enabled, repo->composefs_wanted);
668665
if (repo->composefs_wanted == OT_TRISTATE_YES)
669666
composefs_enabled = repo->composefs_wanted;
670-
if (composefs_enabled == OT_TRISTATE_YES)
667+
668+
guint64 composefs_start_time = 0;
669+
guint64 composefs_end_time = 0;
670+
#ifdef HAVE_COMPOSEFS
671+
if (composefs_enabled != OT_TRISTATE_NO)
671672
{
672673
composefs_start_time = g_get_monotonic_time ();
673674
// TODO: Clean up our mess around composefs/fsverity...we have duplication
@@ -694,6 +695,9 @@ checkout_deployment_tree (OstreeSysroot *sysroot, OstreeRepo *repo, OstreeDeploy
694695
}
695696
else
696697
g_debug ("not using composefs");
698+
#else
699+
if (composefs_enabled == OT_TRISTATE_YES)
700+
return glnx_throw (error, "composefs: enabled at runtime, but support is not compiled in");
697701
#endif
698702

699703
*checkout_elapsed = (checkout_end_time - checkout_start_time);

tests/admin-test.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ assert_not_file_has_content status.txt "pending"
7171
assert_not_file_has_content status.txt "rollback"
7272
validate_bootloader
7373

74-
# Someday probably soon we'll turn this on by default, but for now
75-
if test -f sysroot/ostree/deploy/testos/deploy/*.0/.ostree.cfs; then
76-
fatal "found composefs unexpectedly"
74+
if has_ostree_feature composefs; then
75+
if ! test -f sysroot/ostree/deploy/testos/deploy/*.0/.ostree.cfs; then
76+
fatal "missing composefs"
77+
fi
7778
fi
7879

7980
# Test the bootable and linux keys

tests/test-admin-deploy-composefs.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,32 @@ skip_without_ostree_feature composefs
2626
# Exports OSTREE_SYSROOT so --sysroot not needed.
2727
setup_os_repository "archive" "syslinux"
2828

29+
# check disablement
2930
cd osdata
3031
mkdir -p usr/lib/ostree
3132
cat > usr/lib/ostree/prepare-root.conf << 'EOF'
3233
[composefs]
34+
enabled=false
35+
EOF
36+
cd -
37+
38+
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string version=1.composefs -b testos/buildmain/x86_64-runtime osdata
39+
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime
40+
41+
${CMD_PREFIX} ostree admin deploy --os=testos --karg=root=LABEL=foo --karg=testkarg=1 testos:testos/buildmain/x86_64-runtime
42+
if test -f sysroot/ostree/deploy/testos/deploy/*.0/.ostree.cfs; then
43+
fatal "found composefs unexpectedly"
44+
fi
45+
46+
# check explicit enablement
47+
cd osdata
48+
cat > usr/lib/ostree/prepare-root.conf << 'EOF'
49+
[composefs]
3350
enabled=true
3451
EOF
35-
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string version=1.composefs -b testos/buildmain/x86_64-runtime
3652
cd -
53+
54+
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string version=1.composefs -b testos/buildmain/x86_64-runtime osdata
3755
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime
3856

3957
${CMD_PREFIX} ostree admin deploy --os=testos --karg=root=LABEL=foo --karg=testkarg=1 testos:testos/buildmain/x86_64-runtime

0 commit comments

Comments
 (0)