@@ -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,20 @@ 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. require_boot_dir ( ) ?;
269+
270+ let deployments = storage
271+ . physical_root
268272 . read_dir ( STATE_DIR_RELATIVE )
269273 . with_context ( || format ! ( "Reading sysroot {STATE_DIR_RELATIVE}" ) ) ?;
270274
@@ -348,30 +352,10 @@ pub(crate) async fn composefs_deployment_status_from(
348352
349353 let booted = host. require_composefs_booted ( ) ?;
350354
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-
371355 let is_rollback_queued = match booted. bootloader {
372356 Bootloader :: Grub => match boot_type {
373357 BootType :: Bls => {
374- let bls_config = get_sorted_type1_boot_entries ( & boot_dir, false ) ?;
358+ let bls_config = get_sorted_type1_boot_entries ( boot_dir, false ) ?;
375359 let bls_config = bls_config
376360 . first ( )
377361 . ok_or ( anyhow:: anyhow!( "First boot entry not found" ) ) ?;
@@ -392,7 +376,7 @@ pub(crate) async fn composefs_deployment_status_from(
392376 BootType :: Uki => {
393377 let mut s = String :: new ( ) ;
394378
395- !get_sorted_grub_uki_boot_entries ( & boot_dir, & mut s) ?
379+ !get_sorted_grub_uki_boot_entries ( boot_dir, & mut s) ?
396380 . first ( )
397381 . ok_or ( anyhow:: anyhow!( "First boot entry not found" ) ) ?
398382 . body
@@ -403,7 +387,7 @@ pub(crate) async fn composefs_deployment_status_from(
403387
404388 // We will have BLS stuff and the UKI stuff in the same DIR
405389 Bootloader :: Systemd => {
406- let bls_config = get_sorted_type1_boot_entries ( & boot_dir, false ) ?;
390+ let bls_config = get_sorted_type1_boot_entries ( boot_dir, false ) ?;
407391 let bls_config = bls_config
408392 . first ( )
409393 . ok_or ( anyhow:: anyhow!( "First boot entry not found" ) ) ?;
0 commit comments