Skip to content

Commit 22cb752

Browse files
committed
use oci:// prefix to mark OCI images
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
1 parent 99f0128 commit 22cb752

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ fls from-url \
118118
using the system `fastboot` CLI:
119119

120120
```bash
121-
fls fastboot quay.io/org/image:latest
121+
fls fastboot oci://quay.io/org/image:latest
122122
```
123123

124124
Provide explicit partition mappings when the OCI image contains multiple files:
125125

126126
```bash
127-
fls fastboot quay.io/org/image:latest \
127+
fls fastboot oci://quay.io/org/image:latest \
128128
-t boot_a:boot_a.simg \
129129
-t system_a:system_a.simg
130130
```

src/fls/fastboot.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ impl Error for FastbootError {}
4747
/// Main entry point for fastboot flashing
4848
///
4949
/// Downloads an OCI image and flashes it to a fastboot device via the system fastboot CLI.
50-
/// The image_ref should be an OCI image reference (e.g., "registry.example.com/my-image:latest")
50+
/// The image_ref should be an OCI image reference without a scheme
51+
/// (e.g., "registry.example.com/my-image:latest").
5152
pub async fn flash_from_fastboot(
5253
image_ref: &str,
5354
options: FastbootOptions,

src/main.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ enum Commands {
8484
},
8585
/// Flash an OCI image to fastboot partitions via USB
8686
Fastboot {
87-
/// OCI image reference to download and flash (e.g., "registry.example.com/my-image:latest")
87+
/// OCI image reference to download and flash (must be prefixed with "oci://")
8888
image_ref: String,
8989
/// Device serial number (optional, will use first device if not specified)
9090
#[arg(short = 's', long)]
@@ -301,8 +301,20 @@ async fn main() {
301301
username,
302302
password,
303303
} => {
304+
let image_ref_input = image_ref;
305+
let image_ref = match image_ref_input.strip_prefix("oci://") {
306+
Some(reference) => reference,
307+
None => {
308+
eprintln!(
309+
"Error: fastboot expects an OCI image reference prefixed with 'oci://'"
310+
);
311+
eprintln!(" Example: fls fastboot oci://quay.io/org/image:latest");
312+
std::process::exit(1);
313+
}
314+
};
315+
304316
println!("Fastboot flash command:");
305-
println!(" Image: {}", image_ref);
317+
println!(" Image: {}", image_ref_input);
306318
if let Some(ref serial) = serial {
307319
println!(" Device serial: {}", serial);
308320
}
@@ -347,7 +359,7 @@ async fn main() {
347359
password,
348360
};
349361

350-
match fls::flash_from_fastboot(&image_ref, options).await {
362+
match fls::flash_from_fastboot(image_ref, options).await {
351363
Ok(_) => {
352364
println!("Result: FLASH_COMPLETED");
353365
std::process::exit(0);

0 commit comments

Comments
 (0)