Skip to content

Commit

Permalink
Merge pull request #910 from omertuc/warn_on_host
Browse files Browse the repository at this point in the history
install: Fix broken warn_on_host_root check
  • Loading branch information
cgwalters authored Nov 26, 2024
2 parents 7c8121a + b57fcad commit d42710e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1716,6 +1716,14 @@ pub(crate) async fn install_to_filesystem(
}
}

// Check to see if this happens to be the real host root
if !fsopts.acknowledge_destructive {
let root_path = &fsopts.root_path;
let rootfs_fd = Dir::open_ambient_dir(root_path, cap_std::ambient_authority())
.with_context(|| format!("Opening target root directory {root_path}"))?;
warn_on_host_root(&rootfs_fd)?;
}

// If we're installing to an ostree root, then find the physical root from
// the deployment root.
let possible_physical_root = fsopts.root_path.join("sysroot");
Expand All @@ -1741,11 +1749,6 @@ pub(crate) async fn install_to_filesystem(
rootfs_fd
};

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

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

0 comments on commit d42710e

Please sign in to comment.