Skip to content

Commit 3e11ccd

Browse files
Johan-Liebert1travier
authored andcommitted
WIP: bootc install-to-filesystem fixes
1 parent 181999e commit 3e11ccd

File tree

3 files changed

+43
-3
lines changed

3 files changed

+43
-3
lines changed

crates/lib/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ similar-asserts = { workspace = true }
7474
static_assertions = { workspace = true }
7575

7676
[features]
77-
default = ["install-to-disk"]
77+
default = ["install-to-disk", "composefs-backend"]
7878
# This feature enables `bootc install to-disk`, which is considered just a "demo"
7979
# or reference installer; we expect most nontrivial use cases to be using
8080
# `bootc install to-filesystem`.

crates/lib/src/bootc_composefs/repo.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ pub(crate) async fn initialize_composefs_repository(
4949
&Arc::new(repo),
5050
&format!("{transport}{image_name}"),
5151
None,
52-
None,
52+
Some(ostree_ext::containers_image_proxy::ImageProxyConfig {
53+
insecure_skip_tls_verification: Some(true),
54+
..Default::default()
55+
}),
5356
)
5457
.await
5558
}

crates/lib/src/install.rs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,14 @@ pub(crate) struct InstallToFilesystemOpts {
348348

349349
#[clap(flatten)]
350350
pub(crate) config_opts: InstallConfigOpts,
351+
352+
#[clap(long)]
353+
#[cfg(feature = "composefs-backend")]
354+
pub(crate) composefs_native: bool,
355+
356+
#[cfg(feature = "composefs-backend")]
357+
#[clap(flatten)]
358+
pub(crate) compoesfs_opts: InstallComposefsOpts,
351359
}
352360

353361
#[derive(Debug, Clone, clap::Parser, PartialEq, Eq)]
@@ -969,6 +977,7 @@ pub(crate) fn exec_in_host_mountns(args: &[std::ffi::OsString]) -> Result<()> {
969977
Err(Command::new(cmd).args(args).arg0(bootc_utils::NAME).exec()).context("exec")?
970978
}
971979

980+
#[derive(Debug)]
972981
pub(crate) struct RootSetup {
973982
#[cfg(feature = "install-to-disk")]
974983
luks_device: Option<String>,
@@ -1512,6 +1521,9 @@ async fn install_to_filesystem_impl(
15121521
}
15131522
}
15141523

1524+
println!("state: {state:#?}");
1525+
println!("root_setup: {rootfs:#?}");
1526+
15151527
#[cfg(feature = "composefs-backend")]
15161528
if state.composefs_options.is_some() {
15171529
// Load a fd for the mounted target physical root
@@ -1548,6 +1560,8 @@ pub(crate) async fn install_to_disk(mut opts: InstallToDiskOpts) -> Result<()> {
15481560
#[cfg(feature = "composefs-backend")]
15491561
opts.validate()?;
15501562

1563+
println!("install to disk opts: {opts:#?}");
1564+
15511565
// Log the disk installation operation to systemd journal
15521566
const INSTALL_DISK_JOURNAL_ID: &str = "8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d3e2";
15531567
let source_image = opts
@@ -1832,12 +1846,28 @@ pub(crate) async fn install_to_filesystem(
18321846
target_path
18331847
);
18341848

1849+
println!("opts: {opts:#?}");
1850+
18351851
// Gather global state, destructuring the provided options.
18361852
// IMPORTANT: We might re-execute the current process in this function (for SELinux among other things)
18371853
// IMPORTANT: and hence anything that is done before MUST BE IDEMPOTENT.
18381854
// IMPORTANT: In practice, we should only be gathering information before this point,
18391855
// IMPORTANT: and not performing any mutations at all.
1840-
let state = prepare_install(opts.config_opts, opts.source_opts, opts.target_opts, None).await?;
1856+
let state = prepare_install(
1857+
opts.config_opts,
1858+
opts.source_opts,
1859+
opts.target_opts,
1860+
#[cfg(feature = "composefs-backend")]
1861+
if opts.composefs_native {
1862+
Some(opts.compoesfs_opts)
1863+
} else {
1864+
None
1865+
},
1866+
#[cfg(not(feature = "composefs-backend"))]
1867+
None,
1868+
)
1869+
.await?;
1870+
18411871
// And the last bit of state here is the fsopts, which we also destructure now.
18421872
let mut fsopts = opts.filesystem_opts;
18431873

@@ -2105,6 +2135,13 @@ pub(crate) async fn install_to_existing_root(opts: InstallToExistingRootOpts) ->
21052135
source_opts: opts.source_opts,
21062136
target_opts: opts.target_opts,
21072137
config_opts: opts.config_opts,
2138+
#[cfg(feature = "composefs-backend")]
2139+
composefs_native: false,
2140+
#[cfg(feature = "composefs-backend")]
2141+
compoesfs_opts: InstallComposefsOpts {
2142+
insecure: false,
2143+
bootloader: Bootloader::Grub,
2144+
},
21082145
};
21092146

21102147
install_to_filesystem(opts, true, cleanup).await

0 commit comments

Comments
 (0)