From 5dbf3571950eaa432e50d95e7dc0251587ab0613 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 21 Aug 2023 09:29:55 -0400 Subject: [PATCH] cli: Make `--sysroot` optional To make it less likely people run into the footgun of specifying `--sysroot /sysroot` which is buggy right now https://github.com/ostreedev/ostree/issues/2992 --- lib/src/cli.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/src/cli.rs b/lib/src/cli.rs index ffdf5804..949e3310 100644 --- a/lib/src/cli.rs +++ b/lib/src/cli.rs @@ -292,7 +292,7 @@ pub(crate) enum ContainerImageOpts { Deploy { /// Path to the system root #[clap(long)] - sysroot: String, + sysroot: Option, /// Name for the state directory, also known as "osname". #[clap(long, default_value = ostree_container::deploy::STATEROOT_DEFAULT)] @@ -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();