Skip to content

Commit

Permalink
Merge pull request containers#604 from cgwalters/to-existing-root-dou…
Browse files Browse the repository at this point in the history
…ble-warn

install: Move warning after state and possible re-exec
  • Loading branch information
cgwalters authored Jun 14, 2024
2 parents 8f0a0cf + 28e24c2 commit 2138aa0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1442,14 +1442,18 @@ pub(crate) async fn install_to_filesystem(
anyhow::bail!("Not a mountpoint: {root_path}");
}

// Gather global state, destructuring the provided options.
// IMPORTANT: We might re-execute the current process in this function (for SELinux among other things)
// IMPORTANT: and hence anything that is done before MUST BE IDEMPOTENT.
// IMPORTANT: In practice, we should only be gathering information before this point,
// IMPORTANT: and not performing any mutations at all.
let state = prepare_install(opts.config_opts, opts.source_opts, opts.target_opts).await?;

// Check to see if this happens to be the real host root
if !fsopts.acknowledge_destructive {
warn_on_host_root(&rootfs_fd)?;
}

// Gather global state, destructuring the provided options
let state = prepare_install(opts.config_opts, opts.source_opts, opts.target_opts).await?;

match fsopts.replace {
Some(ReplaceMode::Wipe) => {
let rootfs_fd = rootfs_fd.try_clone()?;
Expand Down

0 comments on commit 2138aa0

Please sign in to comment.