Skip to content

Commit

Permalink
Merge pull request #912 from cgwalters/install-reexec-earlier
Browse files Browse the repository at this point in the history
install: Move re-exec earlier
  • Loading branch information
cgwalters authored Nov 20, 2024
2 parents 0f6496c + 64370c4 commit 93a8277
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,13 @@ pub(crate) async fn install_to_filesystem(
opts: InstallToFilesystemOpts,
targeting_host_root: bool,
) -> Result<()> {
// 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?;
// And the last bit of state here is the fsopts, which we also destructure now.
let mut fsopts = opts.filesystem_opts;

// Check that the target is a directory
Expand Down Expand Up @@ -1680,13 +1687,6 @@ pub(crate) async fn install_to_filesystem(
rootfs_fd
};

// 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)?;
Expand Down

0 comments on commit 93a8277

Please sign in to comment.