Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install: Fix broken warn_on_host_root check #910

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1653,11 +1653,15 @@ pub(crate) async fn install_to_filesystem(
// the deployment root.
let possible_physical_root = fsopts.root_path.join("sysroot");
let possible_ostree_dir = possible_physical_root.join("ostree");
if possible_ostree_dir.exists() {
let original_root_path = if possible_ostree_dir.exists() {
tracing::debug!(
"ostree detected in {possible_ostree_dir}, assuming target is a deployment root and using {possible_physical_root}"
);
let original = fsopts.root_path.clone();
fsopts.root_path = possible_physical_root;
original
} else {
fsopts.root_path.clone()
};

// Get a file descriptor for the root path
Expand All @@ -1683,7 +1687,10 @@ pub(crate) async fn install_to_filesystem(

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

match fsopts.replace {
Expand Down