Skip to content

Commit c00adee

Browse files
committed
container/lint: Add --rootfs
Intended to pair with things like coreos/rpm-ostree#5211 where we operate on a non-booted root. Signed-off-by: Colin Walters <[email protected]>
1 parent 8dff320 commit c00adee

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

docs/src/man/bootc-container-lint.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ checks as part of a container build
55

66
# SYNOPSIS
77

8-
**bootc container lint** \[**-h**\|**\--help**\]
8+
**bootc container lint** \[**\--rootfs**\] \[**-h**\|**\--help**\]
99

1010
# DESCRIPTION
1111

@@ -17,6 +17,10 @@ part of a build process; it will error if any problems are detected.
1717

1818
# OPTIONS
1919

20+
**\--rootfs**=*ROOTFS* \[default: /\]
21+
22+
: Operate on the provided rootfs
23+
2024
**-h**, **\--help**
2125

2226
: Print help (see a summary with -h)

lib/src/cli.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,11 @@ pub(crate) enum ContainerOpts {
245245
///
246246
/// This is intended to be invoked via e.g. `RUN bootc container lint` as part
247247
/// of a build process; it will error if any problems are detected.
248-
Lint,
248+
Lint {
249+
/// Operate on the provided rootfs.
250+
#[clap(long, default_value = "/")]
251+
rootfs: Utf8PathBuf,
252+
},
249253
}
250254

251255
/// Subcommands which operate on images.
@@ -1014,13 +1018,13 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
10141018
Opt::Edit(opts) => edit(opts).await,
10151019
Opt::UsrOverlay => usroverlay().await,
10161020
Opt::Container(opts) => match opts {
1017-
ContainerOpts::Lint => {
1021+
ContainerOpts::Lint { rootfs } => {
10181022
if !ostree_ext::container_utils::is_ostree_container()? {
10191023
anyhow::bail!(
10201024
"Not in a ostree container, this command only verifies ostree containers."
10211025
);
10221026
}
1023-
1027+
let root = &Dir::open_ambient_dir(rootfs, cap_std::ambient_authority())?;
10241028
lints::lint(root)?;
10251029
Ok(())
10261030
}

0 commit comments

Comments
 (0)