Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ CLIPPY_CONFIG = -A clippy::all -D clippy::correctness -D clippy::suspicious -Dun
validate-rust:
cargo fmt -- --check -l
cargo test --no-run
(cd ostree-ext && cargo check --no-default-features)
(cd lib && cargo check --no-default-features)
cargo clippy -- $(CLIPPY_CONFIG)
env RUSTDOCFLAGS='-D warnings' cargo doc --lib
Expand Down
15 changes: 9 additions & 6 deletions ostree-ext/src/container/deploy.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
//! Perform initial setup for a container image based system root

use std::collections::HashSet;
#[cfg(feature = "bootc")]
use std::os::fd::BorrowedFd;
use std::process::Command;

use anyhow::Result;
use bootc_utils::CommandRunExt;
use cap_std_ext::cmdext::CapStdExtCommandExt;
use fn_error_context::context;
use ocidir::cap_std::fs::Dir;
use ostree::glib;

use super::store::{gc_image_layers, LayeredImageState};
Expand Down Expand Up @@ -58,6 +55,7 @@ pub struct DeployOpts<'a> {

// Access the file descriptor for a sysroot
#[allow(unsafe_code)]
#[cfg(feature = "bootc")]
pub(crate) fn sysroot_fd(sysroot: &ostree::Sysroot) -> BorrowedFd {
unsafe { BorrowedFd::borrow_raw(sysroot.fd()) }
}
Expand All @@ -72,7 +70,6 @@ pub async fn deploy(
imgref: &OstreeImageReference,
options: Option<DeployOpts<'_>>,
) -> Result<Box<LayeredImageState>> {
let sysroot_dir = &Dir::reopen_dir(&sysroot_fd(sysroot))?;
let cancellable = ostree::gio::Cancellable::NONE;
let options = options.unwrap_or_default();
let repo = &sysroot.repo();
Expand Down Expand Up @@ -147,9 +144,15 @@ pub async fn deploy(
// doesn't try to invoke this, as that won't work right now.
#[cfg(feature = "bootc")]
if !options.skip_completion {
use bootc_utils::CommandRunExt;
use cap_std_ext::cmdext::CapStdExtCommandExt;
use ocidir::cap_std::fs::Dir;

let sysroot_dir = &Dir::reopen_dir(&sysroot_fd(sysroot))?;

// Note that the sysroot is provided as `.` but we use cwd_dir to
// make the process current working directory the sysroot.
let st = Command::new("/proc/self/exe")
let st = std::process::Command::new("/proc/self/exe")
.args(["internals", "bootc-install-completion", ".", stateroot])
.cwd_dir(sysroot_dir.try_clone()?)
.lifecycle_bind()
Expand Down