@@ -91,7 +91,6 @@ use rustix::{mount::MountFlags, path::Arg};
9191use schemars:: JsonSchema ;
9292use serde:: { Deserialize , Serialize } ;
9393
94- use crate :: parsers:: bls_config:: { BLSConfig , BLSConfigType } ;
9594use crate :: task:: Task ;
9695use crate :: {
9796 bootc_composefs:: repo:: get_imgref,
@@ -109,6 +108,10 @@ use crate::{
109108 bootc_composefs:: status:: get_container_manifest_and_config, bootc_kargs:: compute_new_kargs,
110109} ;
111110use crate :: { bootc_composefs:: status:: get_sorted_grub_uki_boot_entries, install:: PostFetchState } ;
111+ use crate :: {
112+ composefs_consts:: UKI_NAME_PREFIX ,
113+ parsers:: bls_config:: { BLSConfig , BLSConfigType } ,
114+ } ;
112115use crate :: {
113116 composefs_consts:: {
114117 BOOT_LOADER_ENTRIES , COMPOSEFS_CMDLINE , ORIGIN_KEY_BOOT , ORIGIN_KEY_BOOT_DIGEST ,
@@ -274,10 +277,26 @@ pub(crate) fn secondary_sort_key(os_id: &str) -> String {
274277}
275278
276279/// Returns the name of the directory where we store Type1 boot entries
277- pub ( crate ) fn get_type1_dir_name ( depl_verity : & String ) -> String {
280+ pub ( crate ) fn get_type1_dir_name ( depl_verity : & str ) -> String {
278281 format ! ( "{TYPE1_BOOT_DIR_PREFIX}{depl_verity}" )
279282}
280283
284+ /// Returns the name of a UKI given verity digest
285+ pub ( crate ) fn get_uki_name ( depl_verity : & str ) -> String {
286+ format ! ( "{UKI_NAME_PREFIX}{depl_verity}{EFI_EXT}" )
287+ }
288+
289+ /// Returns the name of a UKI Addon directory given verity digest
290+ pub ( crate ) fn get_uki_addon_dir_name ( depl_verity : & str ) -> String {
291+ format ! ( "{UKI_NAME_PREFIX}{depl_verity}{EFI_ADDON_DIR_EXT}" )
292+ }
293+
294+ #[ allow( dead_code) ]
295+ /// Returns the name of a UKI Addon given verity digest
296+ pub ( crate ) fn get_uki_addon_file_name ( depl_verity : & str ) -> String {
297+ format ! ( "{UKI_NAME_PREFIX}{depl_verity}{EFI_ADDON_FILE_EXT}" )
298+ }
299+
281300/// Compute SHA256Sum of VMlinuz + Initrd
282301///
283302/// # Arguments
@@ -873,7 +892,7 @@ fn write_pe_to_esp(
873892 Some ( parent) => {
874893 let renamed_path = match parent. as_str ( ) . ends_with ( EFI_ADDON_DIR_EXT ) {
875894 true => {
876- let dir_name = format ! ( "{}{}" , uki_id. to_hex( ) , EFI_ADDON_DIR_EXT ) ;
895+ let dir_name = get_uki_addon_dir_name ( & uki_id. to_hex ( ) ) ;
877896
878897 parent
879898 . parent ( )
@@ -897,7 +916,7 @@ fn write_pe_to_esp(
897916 . with_context ( || format ! ( "Opening {final_pe_path:?}" ) ) ?;
898917
899918 let pe_name = match pe_type {
900- PEType :: Uki => & format ! ( "{}{}" , uki_id. to_hex( ) , EFI_EXT ) ,
919+ PEType :: Uki => & get_uki_name ( & uki_id. to_hex ( ) ) ,
901920 PEType :: UkiAddon => file_path
902921 . components ( )
903922 . last ( )
@@ -1017,7 +1036,7 @@ fn write_systemd_uki_config(
10171036 bls_conf
10181037 . with_title ( boot_label. boot_label )
10191038 . with_cfg ( BLSConfigType :: EFI {
1020- efi : format ! ( "/{BOOTC_UKI_DIR}/{}{} " , id. to_hex( ) , EFI_EXT ) . into ( ) ,
1039+ efi : format ! ( "/{BOOTC_UKI_DIR}/{}" , get_uki_name ( & id. to_hex( ) ) ) . into ( ) ,
10211040 } )
10221041 . with_sort_key ( primary_sort_key. clone ( ) )
10231042 . with_version ( boot_label. version . unwrap_or_else ( || id. to_hex ( ) ) ) ;
0 commit comments