Skip to content

Commit 71fa274

Browse files
WIP: bootc install-to-filesystem fixes
1 parent 3366c40 commit 71fa274

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
@@ -73,7 +73,7 @@ similar-asserts = { workspace = true }
7373
static_assertions = { workspace = true }
7474

7575
[features]
76-
default = ["install-to-disk"]
76+
default = ["install-to-disk", "composefs-backend"]
7777
# This feature enables `bootc install to-disk`, which is considered just a "demo"
7878
# or reference installer; we expect most nontrivial use cases to be using
7979
# `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
@@ -355,6 +355,14 @@ pub(crate) struct InstallToFilesystemOpts {
355355

356356
#[clap(flatten)]
357357
pub(crate) config_opts: InstallConfigOpts,
358+
359+
#[clap(long)]
360+
#[cfg(feature = "composefs-backend")]
361+
pub(crate) composefs_native: bool,
362+
363+
#[cfg(feature = "composefs-backend")]
364+
#[clap(flatten)]
365+
pub(crate) compoesfs_opts: InstallComposefsOpts,
358366
}
359367

360368
#[derive(Debug, Clone, clap::Parser, PartialEq, Eq)]
@@ -976,6 +984,7 @@ pub(crate) fn exec_in_host_mountns(args: &[std::ffi::OsString]) -> Result<()> {
976984
Err(Command::new(cmd).args(args).arg0(bootc_utils::NAME).exec()).context("exec")?
977985
}
978986

987+
#[derive(Debug)]
979988
pub(crate) struct RootSetup {
980989
#[cfg(feature = "install-to-disk")]
981990
luks_device: Option<String>,
@@ -1519,6 +1528,9 @@ async fn install_to_filesystem_impl(
15191528
}
15201529
}
15211530

1531+
println!("state: {state:#?}");
1532+
println!("root_setup: {rootfs:#?}");
1533+
15221534
#[cfg(feature = "composefs-backend")]
15231535
if state.composefs_options.is_some() {
15241536
// Load a fd for the mounted target physical root
@@ -1555,6 +1567,8 @@ pub(crate) async fn install_to_disk(mut opts: InstallToDiskOpts) -> Result<()> {
15551567
#[cfg(feature = "composefs-backend")]
15561568
opts.validate()?;
15571569

1570+
println!("install to disk opts: {opts:#?}");
1571+
15581572
// Log the disk installation operation to systemd journal
15591573
const INSTALL_DISK_JOURNAL_ID: &str = "8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d3e2";
15601574
let source_image = opts
@@ -1839,12 +1853,28 @@ pub(crate) async fn install_to_filesystem(
18391853
target_path
18401854
);
18411855

1856+
println!("opts: {opts:#?}");
1857+
18421858
// Gather global state, destructuring the provided options.
18431859
// IMPORTANT: We might re-execute the current process in this function (for SELinux among other things)
18441860
// IMPORTANT: and hence anything that is done before MUST BE IDEMPOTENT.
18451861
// IMPORTANT: In practice, we should only be gathering information before this point,
18461862
// IMPORTANT: and not performing any mutations at all.
1847-
let state = prepare_install(opts.config_opts, opts.source_opts, opts.target_opts, None).await?;
1863+
let state = prepare_install(
1864+
opts.config_opts,
1865+
opts.source_opts,
1866+
opts.target_opts,
1867+
#[cfg(feature = "composefs-backend")]
1868+
if opts.composefs_native {
1869+
Some(opts.compoesfs_opts)
1870+
} else {
1871+
None
1872+
},
1873+
#[cfg(not(feature = "composefs-backend"))]
1874+
None,
1875+
)
1876+
.await?;
1877+
18481878
// And the last bit of state here is the fsopts, which we also destructure now.
18491879
let mut fsopts = opts.filesystem_opts;
18501880

@@ -2112,6 +2142,13 @@ pub(crate) async fn install_to_existing_root(opts: InstallToExistingRootOpts) ->
21122142
source_opts: opts.source_opts,
21132143
target_opts: opts.target_opts,
21142144
config_opts: opts.config_opts,
2145+
#[cfg(feature = "composefs-backend")]
2146+
composefs_native: false,
2147+
#[cfg(feature = "composefs-backend")]
2148+
compoesfs_opts: InstallComposefsOpts {
2149+
insecure: false,
2150+
bootloader: Bootloader::Grub,
2151+
},
21152152
};
21162153

21172154
install_to_filesystem(opts, true, cleanup).await

0 commit comments

Comments
 (0)