Skip to content

Commit

Permalink
install: Don't unshare if we have an external source
Browse files Browse the repository at this point in the history
This was being done in osbuild work to use `bootc install`,
so we might as well make it automatic.  The environment
variable was not intended as more than a debugging aid.

Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
cgwalters committed Jan 19, 2024
1 parent ac52673 commit eb620cc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,7 @@ async fn prepare_install(
let rootfs = cap_std::fs::Dir::open_ambient_dir("/", cap_std::ambient_authority())
.context("Opening /")?;

let external_source = source_opts.source_imgref.is_some();
let source = match source_opts.source_imgref {
None => {
let container_info = crate::containerenv::get_container_execution_info(&rootfs)?;
Expand Down Expand Up @@ -1004,7 +1005,7 @@ async fn prepare_install(

// Even though we require running in a container, the mounts we create should be specific
// to this process, so let's enter a private mountns to avoid leaking them.
if std::env::var_os("BOOTC_SKIP_UNSHARE").is_none() {
if !external_source && std::env::var_os("BOOTC_SKIP_UNSHARE").is_none() {
super::cli::ensure_self_unshared_mount_namespace().await?;
}

Expand Down

0 comments on commit eb620cc

Please sign in to comment.