1
0
mirror of https://github.com/containers/bootc.git synced 2026-02-05 15:45:53 +01:00

container/lint: Add --rootfs

Intended to pair with things like https://github.com/coreos/rpm-ostree/pull/5211
where we operate on a non-booted root.

Signed-off-by: Colin Walters <walters@verbum.org>
This commit is contained in:
Colin Walters
2025-01-14 13:55:58 -05:00
parent 8dff32080b
commit c00adeec31
2 changed files with 12 additions and 4 deletions

View File

@@ -5,7 +5,7 @@ checks as part of a container build
# SYNOPSIS
**bootc container lint** \[**-h**\|**\--help**\]
**bootc container lint** \[**\--rootfs**\] \[**-h**\|**\--help**\]
# DESCRIPTION
@@ -17,6 +17,10 @@ part of a build process; it will error if any problems are detected.
# OPTIONS
**\--rootfs**=*ROOTFS* \[default: /\]
: Operate on the provided rootfs
**-h**, **\--help**
: Print help (see a summary with -h)

View File

@@ -245,7 +245,11 @@ pub(crate) enum ContainerOpts {
///
/// This is intended to be invoked via e.g. `RUN bootc container lint` as part
/// of a build process; it will error if any problems are detected.
Lint,
Lint {
/// Operate on the provided rootfs.
#[clap(long, default_value = "/")]
rootfs: Utf8PathBuf,
},
}
/// Subcommands which operate on images.
@@ -1014,13 +1018,13 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
Opt::Edit(opts) => edit(opts).await,
Opt::UsrOverlay => usroverlay().await,
Opt::Container(opts) => match opts {
ContainerOpts::Lint => {
ContainerOpts::Lint { rootfs } => {
if !ostree_ext::container_utils::is_ostree_container()? {
anyhow::bail!(
"Not in a ostree container, this command only verifies ostree containers."
);
}
let root = &Dir::open_ambient_dir(rootfs, cap_std::ambient_authority())?;
lints::lint(root)?;
Ok(())
}