Skip to content

Commit 2138aa0

Browse files
authored
Merge pull request #604 from cgwalters/to-existing-root-double-warn
install: Move warning after state and possible re-exec
2 parents 8f0a0cf + 28e24c2 commit 2138aa0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/src/install.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,14 +1442,18 @@ pub(crate) async fn install_to_filesystem(
14421442
anyhow::bail!("Not a mountpoint: {root_path}");
14431443
}
14441444

1445+
// Gather global state, destructuring the provided options.
1446+
// IMPORTANT: We might re-execute the current process in this function (for SELinux among other things)
1447+
// IMPORTANT: and hence anything that is done before MUST BE IDEMPOTENT.
1448+
// IMPORTANT: In practice, we should only be gathering information before this point,
1449+
// IMPORTANT: and not performing any mutations at all.
1450+
let state = prepare_install(opts.config_opts, opts.source_opts, opts.target_opts).await?;
1451+
14451452
// Check to see if this happens to be the real host root
14461453
if !fsopts.acknowledge_destructive {
14471454
warn_on_host_root(&rootfs_fd)?;
14481455
}
14491456

1450-
// Gather global state, destructuring the provided options
1451-
let state = prepare_install(opts.config_opts, opts.source_opts, opts.target_opts).await?;
1452-
14531457
match fsopts.replace {
14541458
Some(ReplaceMode::Wipe) => {
14551459
let rootfs_fd = rootfs_fd.try_clone()?;

0 commit comments

Comments
 (0)