Skip to content

Commit 9bcabc1

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 bedcae1 commit 9bcabc1

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
@@ -2086,7 +2086,25 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
20862086
Ok(())
20872087
}
20882088
},
2089-
InternalsOpts::Cfs { args } => composefs_ctl::run_from_iter(args.iter()).await,
2089+
InternalsOpts::Cfs { args } => {
2090+
// Inject `--system` (which resolves to /sysroot/composefs) unless the
2091+
// caller has already specified a repo location via --repo, --user, or
2092+
// --system. This ensures `bootc internals cfsctl oci images` (and
2093+
// similar subcommands) operate on the booted composefs repository by
2094+
// default rather than falling back to cfsctl's own heuristic.
2095+
let has_repo_flag = args.iter().any(|a| {
2096+
let s = a.to_string_lossy();
2097+
s == "--repo" || s.starts_with("--repo=") || s == "--user" || s == "--system"
2098+
});
2099+
if has_repo_flag {
2100+
composefs_ctl::run_from_iter(args.iter()).await
2101+
} else {
2102+
composefs_ctl::run_from_iter(
2103+
std::iter::once(OsString::from("--system")).chain(args.into_iter()),
2104+
)
2105+
.await
2106+
}
2107+
}
20902108
InternalsOpts::Reboot => crate::reboot::reboot(),
20912109
InternalsOpts::Fsck => {
20922110
let storage = &get_storage().await?;

0 commit comments

Comments
 (0)