Skip to content

Commit 9357d72

Browse files
committed
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] osbuild/images#1906 Signed-off-by: Michael Vogt <[email protected]>
1 parent 2c34df6 commit 9357d72

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

crates/lib/src/cli.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ pub(crate) enum InstallOpts {
289289
///
290290
/// At the current time, the only output key is `root-fs-type` which is a string-valued
291291
/// filesystem name suitable for passing to `mkfs.$type`.
292-
PrintConfiguration,
292+
PrintConfiguration(crate::install::InstallPrintConfigurationOpts),
293293
}
294294

295295
/// Subcommands which can be executed as part of a container build.
@@ -1483,7 +1483,7 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
14831483
crate::install::install_to_existing_root(opts).await
14841484
}
14851485
InstallOpts::Reset(opts) => crate::install::install_reset(opts).await,
1486-
InstallOpts::PrintConfiguration => crate::install::print_configuration(),
1486+
InstallOpts::PrintConfiguration(opts) => crate::install::print_configuration(opts),
14871487
InstallOpts::EnsureCompletion {} => {
14881488
let rootfs = &Dir::open_ambient_dir("/", cap_std::ambient_authority())?;
14891489
crate::install::completion::run_from_anaconda(rootfs).await

crates/lib/src/install.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,15 @@ pub(crate) struct InstallResetOpts {
437437
karg: Option<Vec<CmdlineOwned>>,
438438
}
439439

440+
#[derive(Debug, clap::Parser, PartialEq, Eq)]
441+
pub(crate) struct InstallPrintConfigurationOpts {
442+
/// Print all configuration.
443+
///
444+
/// Print configuration that is usually handled internally, like kargs.
445+
#[clap(long)]
446+
pub(crate) all: bool,
447+
}
448+
440449
/// Global state captured from the container.
441450
#[derive(Debug, Clone)]
442451
pub(crate) struct SourceInfo {
@@ -722,9 +731,11 @@ impl SourceInfo {
722731
}
723732
}
724733

725-
pub(crate) fn print_configuration() -> Result<()> {
734+
pub(crate) fn print_configuration(opts: InstallPrintConfigurationOpts) -> Result<()> {
726735
let mut install_config = config::load_config()?.unwrap_or_default();
727-
install_config.filter_to_external();
736+
if !opts.all {
737+
install_config.filter_to_external();
738+
}
728739
let stdout = std::io::stdout().lock();
729740
anyhow::Ok(install_config.to_canon_json_writer(stdout)?)
730741
}

0 commit comments

Comments
 (0)