Skip to content

Commit

Permalink
install: Automatically enable --generic-image when --via-loopback
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cgwalters committed Jan 26, 2024
1 parent cbe6062 commit 00b8506
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/src/install.rs
Original file line number Diff line number Diff line change
@@ -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): {}",

0 comments on commit 00b8506

Please sign in to comment.