@@ -5,14 +5,15 @@ use bootc_kernel_cmdline::utf8::Cmdline;
55use fn_error_context:: context;
66
77use crate :: {
8- bootc_composefs:: boot:: { get_esp_partition , get_sysroot_parent_dev , mount_esp , BootType } ,
8+ bootc_composefs:: boot:: BootType ,
99 composefs_consts:: { COMPOSEFS_CMDLINE , ORIGIN_KEY_BOOT_DIGEST , TYPE1_ENT_PATH , USER_CFG } ,
1010 install:: EFI_LOADER_INFO ,
1111 parsers:: {
1212 bls_config:: { parse_bls_config, BLSConfig , BLSConfigType } ,
1313 grub_menuconfig:: { parse_grub_menuentry_file, MenuEntry } ,
1414 } ,
1515 spec:: { BootEntry , BootOrder , Host , HostSpec , ImageReference , ImageStatus } ,
16+ store:: Storage ,
1617 utils:: { read_uefi_var, EfiError } ,
1718} ;
1819
@@ -254,17 +255,23 @@ pub(crate) async fn get_composefs_status(
254255 storage : & crate :: store:: Storage ,
255256 booted_cfs : & crate :: store:: BootedComposefs ,
256257) -> Result < Host > {
257- composefs_deployment_status_from ( & storage. physical_root , booted_cfs. cmdline ) . await
258+ composefs_deployment_status_from ( & storage, booted_cfs. cmdline ) . await
258259}
259260
260261#[ context( "Getting composefs deployment status" ) ]
261262pub ( crate ) async fn composefs_deployment_status_from (
262- sysroot : & Dir ,
263+ storage : & Storage ,
263264 cmdline : & ComposefsCmdline ,
264265) -> Result < Host > {
265266 let composefs_digest = & cmdline. digest ;
266267
267- let deployments = sysroot
268+ let boot_dir = storage
269+ . boot_dir
270+ . as_ref ( )
271+ . ok_or_else ( || anyhow:: anyhow!( "Boot dir not found" ) ) ?;
272+
273+ let deployments = storage
274+ . physical_root
268275 . read_dir ( STATE_DIR_RELATIVE )
269276 . with_context ( || format ! ( "Reading sysroot {STATE_DIR_RELATIVE}" ) ) ?;
270277
@@ -348,30 +355,10 @@ pub(crate) async fn composefs_deployment_status_from(
348355
349356 let booted = host. require_composefs_booted ( ) ?;
350357
351- let ( boot_dir, _temp_guard) = match booted. bootloader {
352- Bootloader :: Grub => ( sysroot. open_dir ( "boot" ) . context ( "Opening boot dir" ) ?, None ) ,
353-
354- // TODO: This is redundant as we should already have ESP mounted at `/efi/` accoding to
355- // spec; currently we do not
356- //
357- // See: https://uapi-group.org/specifications/specs/boot_loader_specification/#mount-points
358- Bootloader :: Systemd => {
359- let parent = get_sysroot_parent_dev ( sysroot) ?;
360- let ( esp_part, ..) = get_esp_partition ( & parent) ?;
361-
362- let esp_mount = mount_esp ( & esp_part) ?;
363-
364- let dir = esp_mount. fd . try_clone ( ) . context ( "Cloning fd" ) ?;
365- let guard = Some ( esp_mount) ;
366-
367- ( dir, guard)
368- }
369- } ;
370-
371358 let is_rollback_queued = match booted. bootloader {
372359 Bootloader :: Grub => match boot_type {
373360 BootType :: Bls => {
374- let bls_config = get_sorted_type1_boot_entries ( & boot_dir, false ) ?;
361+ let bls_config = get_sorted_type1_boot_entries ( boot_dir, false ) ?;
375362 let bls_config = bls_config
376363 . first ( )
377364 . ok_or ( anyhow:: anyhow!( "First boot entry not found" ) ) ?;
@@ -392,7 +379,7 @@ pub(crate) async fn composefs_deployment_status_from(
392379 BootType :: Uki => {
393380 let mut s = String :: new ( ) ;
394381
395- !get_sorted_grub_uki_boot_entries ( & boot_dir, & mut s) ?
382+ !get_sorted_grub_uki_boot_entries ( boot_dir, & mut s) ?
396383 . first ( )
397384 . ok_or ( anyhow:: anyhow!( "First boot entry not found" ) ) ?
398385 . body
@@ -403,7 +390,7 @@ pub(crate) async fn composefs_deployment_status_from(
403390
404391 // We will have BLS stuff and the UKI stuff in the same DIR
405392 Bootloader :: Systemd => {
406- let bls_config = get_sorted_type1_boot_entries ( & boot_dir, false ) ?;
393+ let bls_config = get_sorted_type1_boot_entries ( boot_dir, false ) ?;
407394 let bls_config = bls_config
408395 . first ( )
409396 . ok_or ( anyhow:: anyhow!( "First boot entry not found" ) ) ?;
0 commit comments