Skip to content

Commit 2da8df3

Browse files
Johan-Liebert1travier
authored andcommitted
WIP: bootc install-to-filesystem fixes & composefs-backend
1 parent 3c0d14d commit 2da8df3

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
@@ -372,6 +372,14 @@ pub(crate) struct InstallToFilesystemOpts {
372372

373373
#[clap(flatten)]
374374
pub(crate) config_opts: InstallConfigOpts,
375+
376+
#[clap(long)]
377+
#[cfg(feature = "composefs-backend")]
378+
pub(crate) composefs_native: bool,
379+
380+
#[cfg(feature = "composefs-backend")]
381+
#[clap(flatten)]
382+
pub(crate) compoesfs_opts: InstallComposefsOpts,
375383
}
376384

377385
#[derive(Debug, Clone, clap::Parser, PartialEq, Eq)]
@@ -993,6 +1001,7 @@ pub(crate) fn exec_in_host_mountns(args: &[std::ffi::OsString]) -> Result<()> {
9931001
Err(Command::new(cmd).args(args).arg0(bootc_utils::NAME).exec()).context("exec")?
9941002
}
9951003

1004+
#[derive(Debug)]
9961005
pub(crate) struct RootSetup {
9971006
#[cfg(feature = "install-to-disk")]
9981007
luks_device: Option<String>,
@@ -1536,6 +1545,9 @@ async fn install_to_filesystem_impl(
15361545
}
15371546
}
15381547

1548+
println!("state: {state:#?}");
1549+
println!("root_setup: {rootfs:#?}");
1550+
15391551
#[cfg(feature = "composefs-backend")]
15401552
if state.composefs_options.is_some() {
15411553
// Load a fd for the mounted target physical root
@@ -1572,6 +1584,8 @@ pub(crate) async fn install_to_disk(mut opts: InstallToDiskOpts) -> Result<()> {
15721584
#[cfg(feature = "composefs-backend")]
15731585
opts.validate()?;
15741586

1587+
println!("install to disk opts: {opts:#?}");
1588+
15751589
// Log the disk installation operation to systemd journal
15761590
const INSTALL_DISK_JOURNAL_ID: &str = "8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d3e2";
15771591
let source_image = opts
@@ -1856,12 +1870,28 @@ pub(crate) async fn install_to_filesystem(
18561870
target_path
18571871
);
18581872

1873+
println!("opts: {opts:#?}");
1874+
18591875
// Gather global state, destructuring the provided options.
18601876
// IMPORTANT: We might re-execute the current process in this function (for SELinux among other things)
18611877
// IMPORTANT: and hence anything that is done before MUST BE IDEMPOTENT.
18621878
// IMPORTANT: In practice, we should only be gathering information before this point,
18631879
// IMPORTANT: and not performing any mutations at all.
1864-
let state = prepare_install(opts.config_opts, opts.source_opts, opts.target_opts, None).await?;
1880+
let state = prepare_install(
1881+
opts.config_opts,
1882+
opts.source_opts,
1883+
opts.target_opts,
1884+
#[cfg(feature = "composefs-backend")]
1885+
if opts.composefs_native {
1886+
Some(opts.compoesfs_opts)
1887+
} else {
1888+
None
1889+
},
1890+
#[cfg(not(feature = "composefs-backend"))]
1891+
None,
1892+
)
1893+
.await?;
1894+
18651895
// And the last bit of state here is the fsopts, which we also destructure now.
18661896
let mut fsopts = opts.filesystem_opts;
18671897

@@ -2129,6 +2159,13 @@ pub(crate) async fn install_to_existing_root(opts: InstallToExistingRootOpts) ->
21292159
source_opts: opts.source_opts,
21302160
target_opts: opts.target_opts,
21312161
config_opts: opts.config_opts,
2162+
#[cfg(feature = "composefs-backend")]
2163+
composefs_native: false,
2164+
#[cfg(feature = "composefs-backend")]
2165+
compoesfs_opts: InstallComposefsOpts {
2166+
insecure: false,
2167+
bootloader: Bootloader::Grub,
2168+
},
21322169
};
21332170

21342171
install_to_filesystem(opts, true, cleanup).await

0 commit comments

Comments
 (0)