Skip to content

Commit 8dbe273

Browse files
committed
cli: Add interception for ostree extension verbs
This allows us to fully own the symlinks in `/usr/libexec/libostree/ext`. Signed-off-by: Colin Walters <[email protected]>
1 parent 79e715a commit 8dbe273

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

lib/src/cli.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,9 @@ impl Opt {
907907
InternalsOpts::GENERATOR_BIN => {
908908
Some(["bootc", "internals", "systemd-generator"].as_slice())
909909
}
910+
"ostree-container" | "ostree-ima-sign" | "ostree-provisional-repair" => {
911+
Some(["bootc", "internals", "ostree-ext"].as_slice())
912+
}
910913
_ => None,
911914
};
912915
if let Some(base_args) = mapped {
@@ -1133,4 +1136,31 @@ fn test_parse_ostree_ext() {
11331136
Opt::parse_including_static(["bootc", "internals", "ostree-container"]),
11341137
Opt::Internals(InternalsOpts::OstreeContainer { .. })
11351138
));
1139+
1140+
fn peel(o: Opt) -> Vec<OsString> {
1141+
match o {
1142+
Opt::Internals(InternalsOpts::OstreeExt { args }) => args,
1143+
o => panic!("unexpected {o:?}"),
1144+
}
1145+
}
1146+
let args = peel(Opt::parse_including_static([
1147+
"/usr/libexec/libostree/ext/ostree-ima-sign",
1148+
"ima-sign",
1149+
"--repo=foo",
1150+
"foo",
1151+
"bar",
1152+
"baz",
1153+
]));
1154+
assert_eq!(
1155+
args.as_slice(),
1156+
["ima-sign", "--repo=foo", "foo", "bar", "baz"]
1157+
);
1158+
1159+
let args = peel(Opt::parse_including_static([
1160+
"/usr/libexec/libostree/ext/ostree-container",
1161+
"container",
1162+
"image",
1163+
"pull",
1164+
]));
1165+
assert_eq!(args.as_slice(), ["container", "image", "pull"]);
11361166
}

0 commit comments

Comments
 (0)