@@ -9,6 +9,7 @@ use fn_error_context::context;
9
9
use ostree:: glib;
10
10
use ostree_container:: OstreeImageReference ;
11
11
use ostree_ext:: container as ostree_container;
12
+ use ostree_ext:: container_utils:: composefs_booted;
12
13
use ostree_ext:: container_utils:: ostree_booted;
13
14
use ostree_ext:: keyfileext:: KeyFileExt ;
14
15
use ostree_ext:: oci_spec;
@@ -164,6 +165,7 @@ fn boot_entry_from_deployment(
164
165
// SAFETY: The deployserial is really unsigned
165
166
deploy_serial : deployment. deployserial ( ) . try_into ( ) . unwrap ( ) ,
166
167
} ) ,
168
+ composefs : None ,
167
169
} ;
168
170
Ok ( r)
169
171
}
@@ -293,13 +295,53 @@ pub(crate) async fn status(opts: super::cli::StatusOpts) -> Result<()> {
293
295
0 | 1 => { }
294
296
o => anyhow:: bail!( "Unsupported format version: {o}" ) ,
295
297
} ;
296
- let mut host = if !ostree_booted ( ) ? {
297
- Default :: default ( )
298
- } else {
298
+ let mut host = if ostree_booted ( ) ? {
299
299
let sysroot = super :: cli:: get_storage ( ) . await ?;
300
300
let booted_deployment = sysroot. booted_deployment ( ) ;
301
301
let ( _deployments, host) = get_status ( & sysroot, booted_deployment. as_ref ( ) ) ?;
302
302
host
303
+ } else if composefs_booted ( ) ? {
304
+ let dir_contents = std:: fs:: read_dir ( "/sysroot/composefs/images" ) ?;
305
+
306
+ let host_spec = HostSpec {
307
+ image : Some ( ImageReference {
308
+ image : "" . into ( ) ,
309
+ transport : "" . into ( ) ,
310
+ signature : None ,
311
+ } ) ,
312
+ boot_order : BootOrder :: Default ,
313
+ } ;
314
+
315
+ let mut host = Host :: new ( host_spec) ;
316
+
317
+ let cmdline = crate :: kernel:: parse_cmdline ( ) ?;
318
+ let booted = cmdline. iter ( ) . find_map ( |x| x. strip_prefix ( "composefs=" ) ) ;
319
+
320
+ let Some ( booted) = booted else {
321
+ anyhow:: bail!( "Failed to find composefs parameter in kernel cmdline" ) ;
322
+ } ;
323
+
324
+ host. status = HostStatus {
325
+ staged : None ,
326
+ booted : Some ( BootEntry {
327
+ image : None ,
328
+ cached_update : None ,
329
+ incompatible : false ,
330
+ pinned : false ,
331
+ store : None ,
332
+ ostree : None ,
333
+ composefs : Some ( crate :: spec:: BootEntryComposefs {
334
+ verity : booted. into ( ) ,
335
+ } ) ,
336
+ } ) ,
337
+ rollback : None ,
338
+ rollback_queued : false ,
339
+ ty : None ,
340
+ } ;
341
+
342
+ host
343
+ } else {
344
+ Default :: default ( )
303
345
} ;
304
346
305
347
// We could support querying the staged or rollback deployments
@@ -434,6 +476,27 @@ fn human_render_slot_ostree(
434
476
Ok ( ( ) )
435
477
}
436
478
479
+ /// Output a rendering of a non-container composefs boot entry.
480
+ fn human_render_slot_composefs (
481
+ mut out : impl Write ,
482
+ slot : Slot ,
483
+ entry : & crate :: spec:: BootEntry ,
484
+ erofs_verity : & str ,
485
+ ) -> Result < ( ) > {
486
+ // TODO consider rendering more ostree stuff here like rpm-ostree status does
487
+ let prefix = match slot {
488
+ Slot :: Staged => " Staged composefs" . into ( ) ,
489
+ Slot :: Booted => format ! ( "{} Booted composefs" , crate :: glyph:: Glyph :: BlackCircle ) ,
490
+ Slot :: Rollback => " Rollback composefs" . into ( ) ,
491
+ } ;
492
+ let prefix_len = prefix. len ( ) ;
493
+ writeln ! ( out, "{prefix}" ) ?;
494
+ write_row_name ( & mut out, "Commit" , prefix_len) ?;
495
+ writeln ! ( out, "{erofs_verity}" ) ?;
496
+ tracing:: debug!( "pinned={}" , entry. pinned) ;
497
+ Ok ( ( ) )
498
+ }
499
+
437
500
fn human_readable_output_booted ( mut out : impl Write , host : & Host ) -> Result < ( ) > {
438
501
let mut first = true ;
439
502
for ( slot_name, status) in [
@@ -451,6 +514,8 @@ fn human_readable_output_booted(mut out: impl Write, host: &Host) -> Result<()>
451
514
human_render_slot ( & mut out, slot_name, host_status, image) ?;
452
515
} else if let Some ( ostree) = host_status. ostree . as_ref ( ) {
453
516
human_render_slot_ostree ( & mut out, slot_name, host_status, & ostree. checksum ) ?;
517
+ } else if let Some ( composefs) = & host_status. composefs {
518
+ human_render_slot_composefs ( & mut out, slot_name, host_status, & composefs. verity ) ?;
454
519
} else {
455
520
writeln ! ( out, "Current {slot_name} state is unknown" ) ?;
456
521
}
0 commit comments