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

cli: Make --sysroot optional #516

Merged
merged 1 commit into from
Aug 21, 2023
Merged
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
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
Loading