Skip to content

Commit

Permalink
prepare-root: Default sysroot.readonly=true if composefs
Browse files Browse the repository at this point in the history
Not because it's logically required or anything, but because
it's just a good idea.
  • Loading branch information
cgwalters committed Jul 25, 2023
1 parent 22b8e4f commit 83d37d6
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/switchroot/ostree-prepare-root.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,18 @@ main (int argc, char *argv[])
errx (EXIT_FAILURE, "Failed to parse config: %s", error->message);

gboolean sysroot_readonly = FALSE;
if (!ot_keyfile_get_boolean_with_default (config, SYSROOT_KEY, READONLY_KEY, FALSE,
&sysroot_readonly, &error))

// We always parse the composefs config, because we want to detect and error
// out if it's enabled, but not supported at compile time.
g_autoptr (ComposefsConfig) composefs_config = load_composefs_config (&error);
if (!composefs_config)
errx (EXIT_FAILURE, "%s", error->message);

// If composefs is enabled, that also implies sysroot.readonly=true because it's
// the new default we want to use (not because it's actually required)
const bool sysroot_readonly_default = composefs_config->enabled == OT_TRISTATE_YES;
if (!ot_keyfile_get_boolean_with_default (config, SYSROOT_KEY, READONLY_KEY,
sysroot_readonly_default, &sysroot_readonly, &error))
errx (EXIT_FAILURE, "Failed to parse sysroot.readonly value: %s", error->message);

/* This is the final target where we should prepare the rootfs. The usual
Expand Down Expand Up @@ -398,11 +408,6 @@ main (int argc, char *argv[])
GVariantBuilder metadata_builder;
g_variant_builder_init (&metadata_builder, G_VARIANT_TYPE ("a{sv}"));

// We always parse the composefs config, because we want to detect and error
// out if it's enabled, but not supported at compile time.
g_autoptr (ComposefsConfig) composefs_config = load_composefs_config (&error);
if (!composefs_config)
errx (EXIT_FAILURE, "%s", error->message);
// Tracks if we did successfully enable it at runtime
bool using_composefs = false;

Expand Down

0 comments on commit 83d37d6

Please sign in to comment.