Skip to content

Commit 93a8277

Browse files
authored
Merge pull request #912 from cgwalters/install-reexec-earlier
install: Move re-exec earlier
2 parents 0f6496c + 64370c4 commit 93a8277

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/src/install.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,6 +1642,13 @@ pub(crate) async fn install_to_filesystem(
16421642
opts: InstallToFilesystemOpts,
16431643
targeting_host_root: bool,
16441644
) -> Result<()> {
1645+
// Gather global state, destructuring the provided options.
1646+
// IMPORTANT: We might re-execute the current process in this function (for SELinux among other things)
1647+
// IMPORTANT: and hence anything that is done before MUST BE IDEMPOTENT.
1648+
// IMPORTANT: In practice, we should only be gathering information before this point,
1649+
// IMPORTANT: and not performing any mutations at all.
1650+
let state = prepare_install(opts.config_opts, opts.source_opts, opts.target_opts).await?;
1651+
// And the last bit of state here is the fsopts, which we also destructure now.
16451652
let mut fsopts = opts.filesystem_opts;
16461653

16471654
// Check that the target is a directory
@@ -1680,13 +1687,6 @@ pub(crate) async fn install_to_filesystem(
16801687
rootfs_fd
16811688
};
16821689

1683-
// Gather global state, destructuring the provided options.
1684-
// IMPORTANT: We might re-execute the current process in this function (for SELinux among other things)
1685-
// IMPORTANT: and hence anything that is done before MUST BE IDEMPOTENT.
1686-
// IMPORTANT: In practice, we should only be gathering information before this point,
1687-
// IMPORTANT: and not performing any mutations at all.
1688-
let state = prepare_install(opts.config_opts, opts.source_opts, opts.target_opts).await?;
1689-
16901690
// Check to see if this happens to be the real host root
16911691
if !fsopts.acknowledge_destructive {
16921692
warn_on_host_root(&rootfs_fd)?;

0 commit comments

Comments
 (0)