@@ -27,6 +27,8 @@ use linkme::distributed_slice;
2727use ostree_ext:: ostree_prepareroot;
2828use serde:: Serialize ;
2929
30+ use crate :: bootc_composefs:: boot:: EFI_LINUX ;
31+
3032/// Reference to embedded default baseimage content that should exist.
3133const BASEIMAGE_REF : & str = "usr/share/doc/bootc/baseimage/base" ;
3234// https://systemd.io/API_FILE_SYSTEMS/ with /var added for us
@@ -758,14 +760,24 @@ fn check_boot(root: &Dir, config: &LintExecutionConfig) -> LintResult {
758760 } ;
759761
760762 // First collect all entries to determine if the directory is empty
761- let entries: Result < Vec < _ > , _ > = d. entries ( ) ?. collect ( ) ;
762- let entries = entries?;
763+ let entries: Result < BTreeSet < _ > , _ > = d
764+ . entries ( ) ?
765+ . into_iter ( )
766+ . map ( |v| {
767+ let v = v?;
768+ anyhow:: Ok ( v. file_name ( ) )
769+ } )
770+ . collect ( ) ;
771+ let mut entries = entries?;
772+ // Work around https://github.com/containers/composefs-rs/issues/131
773+ let efidir = Utf8Path :: new ( EFI_LINUX )
774+ . parent ( )
775+ . map ( |b| b. as_std_path ( ) )
776+ . unwrap ( ) ;
777+ entries. remove ( efidir. as_os_str ( ) ) ;
763778 if entries. is_empty ( ) {
764779 return lint_ok ( ) ;
765780 }
766- // Gather sorted filenames
767- let mut entries = entries. iter ( ) . map ( |v| v. file_name ( ) ) . collect :: < Vec < _ > > ( ) ;
768- entries. sort ( ) ;
769781
770782 let header = "Found non-empty /boot" ;
771783 let items = entries. iter ( ) . map ( PathQuotedDisplay :: new) ;
@@ -973,6 +985,12 @@ mod tests {
973985 let root = & passing_fixture ( ) ?;
974986 let config = & LintExecutionConfig :: default ( ) ;
975987 check_boot ( & root, config) . unwrap ( ) . unwrap ( ) ;
988+
989+ // Verify creating EFI doesn't error
990+ root. create_dir_all ( "EFI/Linux" ) ?;
991+ root. write ( "EFI/Linux/foo.efi" , b"some dummy efi" ) ?;
992+ check_boot ( & root, config) . unwrap ( ) . unwrap ( ) ;
993+
976994 root. create_dir ( "boot/somesubdir" ) ?;
977995 let Err ( e) = check_boot ( & root, config) . unwrap ( ) else {
978996 unreachable ! ( )
0 commit comments