From 047ce727c22745b28188e067f92e605c933a819c Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 26 Jan 2024 14:12:01 -0500 Subject: [PATCH] install: Automatically enable --generic-image when --via-loopback It's a bit confusing because `to-disk` is intended primarily for *per machine* installs. However, when used with `--via-loopback` it can be used to make disk images which are probably intended to be generic. For now, let's just automatically flip that on. Signed-off-by: Colin Walters --- lib/src/install.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/src/install.rs b/lib/src/install.rs index fa97452c4..f7f69148e 100644 --- a/lib/src/install.rs +++ b/lib/src/install.rs @@ -1093,13 +1093,18 @@ fn installation_complete() { /// Implementation of the `bootc install to-disk` CLI command. #[context("Installing to disk")] -pub(crate) async fn install_to_disk(opts: InstallToDiskOpts) -> Result<()> { +pub(crate) async fn install_to_disk(mut opts: InstallToDiskOpts) -> Result<()> { let mut block_opts = opts.block_opts; let target_blockdev_meta = block_opts .device .metadata() .with_context(|| format!("Querying {}", &block_opts.device))?; if opts.via_loopback { + if !opts.config_opts.generic_image { + eprintln!("Automatically enabling --generic-image when installing via loopback"); + std::thread::sleep(std::time::Duration::from_secs(2)); + opts.config_opts.generic_image = true; + } if !target_blockdev_meta.file_type().is_file() { anyhow::bail!( "Not a regular file (to be used via loopback): {}",