Skip to content

Commit d42710e

Browse files
authored
Merge pull request #910 from omertuc/warn_on_host
install: Fix broken warn_on_host_root check
2 parents 7c8121a + b57fcad commit d42710e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/src/install.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,6 +1716,14 @@ pub(crate) async fn install_to_filesystem(
17161716
}
17171717
}
17181718

1719+
// Check to see if this happens to be the real host root
1720+
if !fsopts.acknowledge_destructive {
1721+
let root_path = &fsopts.root_path;
1722+
let rootfs_fd = Dir::open_ambient_dir(root_path, cap_std::ambient_authority())
1723+
.with_context(|| format!("Opening target root directory {root_path}"))?;
1724+
warn_on_host_root(&rootfs_fd)?;
1725+
}
1726+
17191727
// If we're installing to an ostree root, then find the physical root from
17201728
// the deployment root.
17211729
let possible_physical_root = fsopts.root_path.join("sysroot");
@@ -1741,11 +1749,6 @@ pub(crate) async fn install_to_filesystem(
17411749
rootfs_fd
17421750
};
17431751

1744-
// Check to see if this happens to be the real host root
1745-
if !fsopts.acknowledge_destructive {
1746-
warn_on_host_root(&rootfs_fd)?;
1747-
}
1748-
17491752
match fsopts.replace {
17501753
Some(ReplaceMode::Wipe) => {
17511754
let rootfs_fd = rootfs_fd.try_clone()?;

0 commit comments

Comments
 (0)