Skip to content

Commit dc7d4cf

Browse files
authored
Merge pull request #1027 from cgwalters/lint-altroot
container/lint: Add --rootfs
2 parents 0767f7d + c00adee commit dc7d4cf

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
@@ -241,7 +241,11 @@ pub(crate) enum ContainerOpts {
241241
///
242242
/// This is intended to be invoked via e.g. `RUN bootc container lint` as part
243243
/// of a build process; it will error if any problems are detected.
244-
Lint,
244+
Lint {
245+
/// Operate on the provided rootfs.
246+
#[clap(long, default_value = "/")]
247+
rootfs: Utf8PathBuf,
248+
},
245249
}
246250

247251
/// Subcommands which operate on images.
@@ -1007,13 +1011,13 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
10071011
Opt::Edit(opts) => edit(opts).await,
10081012
Opt::UsrOverlay => usroverlay().await,
10091013
Opt::Container(opts) => match opts {
1010-
ContainerOpts::Lint => {
1014+
ContainerOpts::Lint { rootfs } => {
10111015
if !ostree_ext::container_utils::is_ostree_container()? {
10121016
anyhow::bail!(
10131017
"Not in a ostree container, this command only verifies ostree containers."
10141018
);
10151019
}
1016-
1020+
let root = &Dir::open_ambient_dir(rootfs, cap_std::ambient_authority())?;
10171021
lints::lint(root)?;
10181022
Ok(())
10191023
}

0 commit comments

Comments
 (0)