Skip to content

Commit 0f285a0

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 d392695 commit 0f285a0

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

0 commit comments

Comments
 (0)