From 67a8df2ffce7688189ab83d60520c05a68c57b75 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 2 Dec 2025 12:49:40 +0100 Subject: [PATCH] cli: add `install print-configuration --all` When `install print-configuration` is run some options (notably the kargs) are currently filtered out. This makes sense because in general `bootc install to-filesystem` takes care of them. However with the recent work in image-builder/osbuild to use bootc containers directly as inputs to build ISOs [0],[1] we would like to get access to the kernel args too because when constructing a bootable ISO we also want to add the bootc container kargs. [0] https://github.com/orgs/osbuild/discussions/45 [1] https://github.com/osbuild/images/pull/1906 --- crates/lib/src/cli.rs | 4 ++-- crates/lib/src/install.rs | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/crates/lib/src/cli.rs b/crates/lib/src/cli.rs index 23bae71d9..c59b4dad1 100644 --- a/crates/lib/src/cli.rs +++ b/crates/lib/src/cli.rs @@ -289,7 +289,7 @@ pub(crate) enum InstallOpts { /// /// At the current time, the only output key is `root-fs-type` which is a string-valued /// filesystem name suitable for passing to `mkfs.$type`. - PrintConfiguration, + PrintConfiguration(crate::install::InstallPrintConfigurationOpts), } /// Subcommands which can be executed as part of a container build. @@ -1483,7 +1483,7 @@ async fn run_from_opt(opt: Opt) -> Result<()> { crate::install::install_to_existing_root(opts).await } InstallOpts::Reset(opts) => crate::install::install_reset(opts).await, - InstallOpts::PrintConfiguration => crate::install::print_configuration(), + InstallOpts::PrintConfiguration(opts) => crate::install::print_configuration(opts), InstallOpts::EnsureCompletion {} => { let rootfs = &Dir::open_ambient_dir("/", cap_std::ambient_authority())?; crate::install::completion::run_from_anaconda(rootfs).await diff --git a/crates/lib/src/install.rs b/crates/lib/src/install.rs index a1e5b2b71..b68cbce8f 100644 --- a/crates/lib/src/install.rs +++ b/crates/lib/src/install.rs @@ -437,6 +437,15 @@ pub(crate) struct InstallResetOpts { karg: Option>, } +#[derive(Debug, clap::Parser, PartialEq, Eq)] +pub(crate) struct InstallPrintConfigurationOpts { + /// Print all configuration. + /// + /// Print configuration that is usually handled internally, like kargs. + #[clap(long)] + pub(crate) all: bool, +} + /// Global state captured from the container. #[derive(Debug, Clone)] pub(crate) struct SourceInfo { @@ -722,9 +731,11 @@ impl SourceInfo { } } -pub(crate) fn print_configuration() -> Result<()> { +pub(crate) fn print_configuration(opts: InstallPrintConfigurationOpts) -> Result<()> { let mut install_config = config::load_config()?.unwrap_or_default(); - install_config.filter_to_external(); + if !opts.all { + install_config.filter_to_external(); + } let stdout = std::io::stdout().lock(); anyhow::Ok(install_config.to_canon_json_writer(stdout)?) }