diff --git a/lib/src/install.rs b/lib/src/install.rs index 352b71688..409f17604 100644 --- a/lib/src/install.rs +++ b/lib/src/install.rs @@ -504,13 +504,19 @@ async fn initialize_ostree_root_from_self( } else { "none" }; - for (k, v) in [ + let composefs_enabled = !state.install_config.disable_composefs.unwrap_or_default(); + tracing::debug!("composefs: {composefs_enabled}"); + let repo_opts = [ ("sysroot.bootloader", bootloader), // Always flip this one on because we need to support alongside installs // to systems without a separate boot partition. ("sysroot.bootprefix", "true"), ("sysroot.readonly", "true"), - ] { + ] + .into_iter() + .chain(composefs_enabled.then_some(("ex-integrity.composefs", "true"))); + + for (k, v) in repo_opts { Task::new("Configuring ostree repo", "ostree") .args(["config", "--repo", "ostree/repo", "set", k, v]) .cwd(rootfs_dir)? diff --git a/lib/src/install/config.rs b/lib/src/install/config.rs index cb1d557f4..506d5593e 100644 --- a/lib/src/install/config.rs +++ b/lib/src/install/config.rs @@ -39,6 +39,8 @@ pub(crate) struct BasicFilesystems { pub(crate) struct InstallConfiguration { /// Root filesystem type pub(crate) root_fs_type: Option, + /// Allow disabling composefs + pub(crate) disable_composefs: Option, pub(crate) filesystem: Option, /// Kernel arguments, applied at installation time #[serde(skip_serializing_if = "Option::is_none")] @@ -93,6 +95,7 @@ impl Mergeable for InstallConfiguration { /// Apply any values in other, overriding any existing values in `self`. fn merge(&mut self, other: Self) { merge_basic(&mut self.root_fs_type, other.root_fs_type); + merge_basic(&mut self.disable_composefs, other.disable_composefs); self.filesystem.merge(other.filesystem); if let Some(other_kargs) = other.kargs { self.kargs @@ -179,6 +182,7 @@ root-fs-type = "xfs" root_fs_type: Some(Filesystem::Ext4), filesystem: None, kargs: None, + ..Default::default() }), }; install.merge(other.install.unwrap()); @@ -206,18 +210,23 @@ kargs = ["console=ttyS0", "foo=bar"] assert_eq!(install.root_fs_type.unwrap(), Filesystem::Ext4); let other = InstallConfigurationToplevel { install: Some(InstallConfiguration { - root_fs_type: None, - filesystem: None, kargs: Some( ["console=tty0", "nosmt"] .into_iter() .map(ToOwned::to_owned) .collect(), ), + ..Default::default() }), }; + assert!(install.disable_composefs.is_none()); install.merge(other.install.unwrap()); + install.merge(InstallConfiguration { + disable_composefs: Some(true), + ..Default::default() + }); assert_eq!(install.root_fs_type.unwrap(), Filesystem::Ext4); + assert!(install.disable_composefs.unwrap()); assert_eq!( install.kargs, Some( @@ -226,7 +235,12 @@ kargs = ["console=ttyS0", "foo=bar"] .map(ToOwned::to_owned) .collect() ) - ) + ); + install.merge(InstallConfiguration { + disable_composefs: Some(false), + ..Default::default() + }); + assert!(!install.disable_composefs.unwrap()); } #[test] @@ -245,13 +259,12 @@ type = "xfs" ); let other = InstallConfigurationToplevel { install: Some(InstallConfiguration { - root_fs_type: None, filesystem: Some(BasicFilesystems { root: Some(RootFS { fstype: Some(Filesystem::Ext4), }), }), - kargs: None, + ..Default::default() }), }; install.merge(other.install.unwrap()); diff --git a/manpages-md-extra/bootc-install-config.md b/manpages-md-extra/bootc-install-config.md index 351493a89..6837797e3 100644 --- a/manpages-md-extra/bootc-install-config.md +++ b/manpages-md-extra/bootc-install-config.md @@ -18,9 +18,10 @@ that can be overridden in a derived container image. This is the only defined toplevel table. -The `install`` section supports two subfields: +The `install`` section supports the following subfields: - `filesystem`: See below. +- `disable_composefs`: A boolean, which will use the legacy ostree mode. - `kargs`: An array of strings; this will be appended to the set of kernel arguments. # filesystem