Skip to content

Commit 7b5b50b

Browse files
committed
cli: Inject --system into bootc internals cfsctl by default
Without this, `bootc internals cfsctl oci images` (and other cfsctl subcommands) would fall back to cfsctl's own default repo heuristic. While cfsctl already picks /sysroot/composefs when running as root, being explicit here documents the intent and makes the behaviour consistent regardless of uid. Pass --system rather than hardcoding the path so the constant lives in one place (cfsctl's system_path()). Users can still override with --repo, --user, or --system and the injected flag is skipped in that case. Assisted-by: OpenCode (claude-sonnet-4-6@default) Signed-off-by: Colin Walters <walters@verbum.org>
1 parent 1bc7462 commit 7b5b50b

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

crates/lib/src/cli.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2092,7 +2092,25 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
20922092
Ok(())
20932093
}
20942094
},
2095-
InternalsOpts::Cfs { args } => composefs_ctl::run_from_iter(args.iter()).await,
2095+
InternalsOpts::Cfs { args } => {
2096+
// Inject `--system` (which resolves to /sysroot/composefs) unless the
2097+
// caller has already specified a repo location via --repo, --user, or
2098+
// --system. This ensures `bootc internals cfsctl oci images` (and
2099+
// similar subcommands) operate on the booted composefs repository by
2100+
// default rather than falling back to cfsctl's own heuristic.
2101+
let has_repo_flag = args.iter().any(|a| {
2102+
let s = a.to_string_lossy();
2103+
s == "--repo" || s.starts_with("--repo=") || s == "--user" || s == "--system"
2104+
});
2105+
if has_repo_flag {
2106+
composefs_ctl::run_from_iter(args.iter()).await
2107+
} else {
2108+
composefs_ctl::run_from_iter(
2109+
std::iter::once(OsString::from("--system")).chain(args.into_iter()),
2110+
)
2111+
.await
2112+
}
2113+
}
20962114
InternalsOpts::Reboot => crate::reboot::reboot(),
20972115
InternalsOpts::Fsck => {
20982116
let storage = &get_storage().await?;

0 commit comments

Comments
 (0)