Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #516 from cgwalters/sysroot-optional
Browse files Browse the repository at this point in the history
cli: Make `--sysroot` optional
  • Loading branch information
jmarrero authored Aug 21, 2023
2 parents 332ad0d + 5dbf357 commit 8502306
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ pub(crate) enum ContainerImageOpts {
Deploy {
/// Path to the system root
#[clap(long)]
sysroot: String,
sysroot: Option<String>,

/// Name for the state directory, also known as "osname".
#[clap(long, default_value = ostree_container::deploy::STATEROOT_DEFAULT)]
Expand Down Expand Up @@ -976,7 +976,11 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
proxyopts,
write_commitid_to,
} => {
let sysroot = &ostree::Sysroot::new(Some(&gio::File::for_path(&sysroot)));
let sysroot = &if let Some(sysroot) = sysroot {
ostree::Sysroot::new(Some(&gio::File::for_path(&sysroot)))
} else {
ostree::Sysroot::new_default()
};
sysroot.load(gio::Cancellable::NONE)?;
let repo = &sysroot.repo();
let kargs = karg.as_deref();
Expand Down

0 comments on commit 8502306

Please sign in to comment.