Skip to content

Commit

Permalink
Merge pull request #285 from cgwalters/warn-via-loopback-generic
Browse files Browse the repository at this point in the history
install: Automatically enable --generic-image when --via-loopback
  • Loading branch information
cgwalters committed Jan 29, 2024
2 parents cbe6062 + 047ce72 commit 6cfb370
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
Expand Up @@ -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): {}",
Expand Down

0 comments on commit 6cfb370

Please sign in to comment.