@@ -10,6 +10,7 @@ use fn_error_context::context;
10
10
use ostree:: glib;
11
11
use ostree_container:: OstreeImageReference ;
12
12
use ostree_ext:: container as ostree_container;
13
+ use ostree_ext:: container_utils:: composefs_booted;
13
14
use ostree_ext:: container_utils:: ostree_booted;
14
15
use ostree_ext:: keyfileext:: KeyFileExt ;
15
16
use ostree_ext:: oci_spec;
@@ -156,6 +157,7 @@ fn boot_entry_from_deployment(
156
157
deploy_serial : deployment. deployserial ( ) . try_into ( ) . unwrap ( ) ,
157
158
stateroot : deployment. stateroot ( ) . into ( ) ,
158
159
} ) ,
160
+ composefs : None ,
159
161
} ;
160
162
Ok ( r)
161
163
}
@@ -292,13 +294,54 @@ pub(crate) async fn status(opts: super::cli::StatusOpts) -> Result<()> {
292
294
0 | 1 => { }
293
295
o => anyhow:: bail!( "Unsupported format version: {o}" ) ,
294
296
} ;
295
- let mut host = if !ostree_booted ( ) ? {
296
- Default :: default ( )
297
- } else {
297
+ let mut host = if ostree_booted ( ) ? {
298
298
let sysroot = super :: cli:: get_storage ( ) . await ?;
299
299
let booted_deployment = sysroot. booted_deployment ( ) ;
300
300
let ( _deployments, host) = get_status ( & sysroot, booted_deployment. as_ref ( ) ) ?;
301
301
host
302
+ } else if composefs_booted ( ) ? {
303
+ let dir_contents = std:: fs:: read_dir ( "/sysroot/composefs/images" ) ?;
304
+
305
+ let host_spec = HostSpec {
306
+ image : Some ( ImageReference {
307
+ image : "" . into ( ) ,
308
+ transport : "" . into ( ) ,
309
+ signature : None ,
310
+ } ) ,
311
+ boot_order : BootOrder :: Default ,
312
+ } ;
313
+
314
+ let mut host = Host :: new ( host_spec) ;
315
+
316
+ let cmdline = crate :: kernel:: parse_cmdline ( ) ?;
317
+ let booted = cmdline. iter ( ) . find_map ( |x| x. strip_prefix ( "composefs=" ) ) ;
318
+
319
+ let Some ( booted) = booted else {
320
+ anyhow:: bail!( "Failed to find composefs parameter in kernel cmdline" ) ;
321
+ } ;
322
+
323
+ host. status = HostStatus {
324
+ staged : None ,
325
+ booted : Some ( BootEntry {
326
+ image : None ,
327
+ cached_update : None ,
328
+ incompatible : false ,
329
+ pinned : false ,
330
+ store : None ,
331
+ ostree : None ,
332
+ composefs : Some ( crate :: spec:: BootEntryComposefs {
333
+ verity : booted. into ( ) ,
334
+ } ) ,
335
+ } ) ,
336
+ other_deployments : vec ! [ ] ,
337
+ rollback : None ,
338
+ rollback_queued : false ,
339
+ ty : None ,
340
+ } ;
341
+
342
+ host
343
+ } else {
344
+ Default :: default ( )
302
345
} ;
303
346
304
347
// We could support querying the staged or rollback deployments
@@ -506,6 +549,27 @@ fn human_render_slot_ostree(
506
549
Ok ( ( ) )
507
550
}
508
551
552
+ /// Output a rendering of a non-container composefs boot entry.
553
+ fn human_render_slot_composefs (
554
+ mut out : impl Write ,
555
+ slot : Slot ,
556
+ entry : & crate :: spec:: BootEntry ,
557
+ erofs_verity : & str ,
558
+ ) -> Result < ( ) > {
559
+ // TODO consider rendering more ostree stuff here like rpm-ostree status does
560
+ let prefix = match slot {
561
+ Slot :: Staged => " Staged composefs" . into ( ) ,
562
+ Slot :: Booted => format ! ( "{} Booted composefs" , crate :: glyph:: Glyph :: BlackCircle ) ,
563
+ Slot :: Rollback => " Rollback composefs" . into ( ) ,
564
+ } ;
565
+ let prefix_len = prefix. len ( ) ;
566
+ writeln ! ( out, "{prefix}" ) ?;
567
+ write_row_name ( & mut out, "Commit" , prefix_len) ?;
568
+ writeln ! ( out, "{erofs_verity}" ) ?;
569
+ tracing:: debug!( "pinned={}" , entry. pinned) ;
570
+ Ok ( ( ) )
571
+ }
572
+
509
573
fn human_readable_output_booted ( mut out : impl Write , host : & Host , verbose : bool ) -> Result < ( ) > {
510
574
let mut first = true ;
511
575
for ( slot_name, status) in [
@@ -529,6 +593,8 @@ fn human_readable_output_booted(mut out: impl Write, host: &Host, verbose: bool)
529
593
& ostree. checksum ,
530
594
verbose,
531
595
) ?;
596
+ } else if let Some ( composefs) = & host_status. composefs {
597
+ human_render_slot_composefs ( & mut out, slot_name, host_status, & composefs. verity ) ?;
532
598
} else {
533
599
writeln ! ( out, "Current {slot_name} state is unknown" ) ?;
534
600
}
0 commit comments