@@ -607,7 +607,7 @@ pub(crate) fn setup_composefs_bls_boot(
607607 )
608608 }
609609
610- Bootloader :: Systemd => {
610+ Bootloader :: Systemd | Bootloader :: GrubCC => {
611611 let efi_mount = mount_esp ( & esp_device) . context ( "Mounting ESP" ) ?;
612612
613613 let mounted_efi = Utf8PathBuf :: from ( efi_mount. dir . path ( ) . as_str ( ) ?) ;
@@ -1169,7 +1169,9 @@ pub(crate) fn setup_composefs_uki_boot(
11691169 write_grub_uki_menuentry ( root_path, & setup_type, uki_info. boot_label , id, & esp_device) ?
11701170 }
11711171
1172- Bootloader :: Systemd => write_systemd_uki_config ( & esp_mount. fd , & setup_type, uki_info, id) ?,
1172+ Bootloader :: Systemd | Bootloader :: GrubCC => {
1173+ write_systemd_uki_config ( & esp_mount. fd , & setup_type, uki_info, id) ?
1174+ }
11731175
11741176 Bootloader :: None => unreachable ! ( "Checked at install time" ) ,
11751177 } ;
@@ -1369,13 +1371,48 @@ pub(crate) async fn setup_composefs_boot(
13691371 & root_setup. device_info . require_single_root ( ) ?,
13701372 boot_uuid,
13711373 ) ?;
1372- } else if postfetch. detected_bootloader == Bootloader :: Grub {
1374+ } else if matches ! (
1375+ postfetch. detected_bootloader,
1376+ Bootloader :: Grub | Bootloader :: GrubCC
1377+ ) {
13731378 crate :: bootloader:: install_via_bootupd (
13741379 & root_setup. device_info ,
13751380 & root_setup. physical_root_path ,
13761381 & state. config_opts ,
13771382 None ,
13781383 ) ?;
1384+
1385+ // FIXME: Remove this hack once we have support in bootupd
1386+ if matches ! ( postfetch. detected_bootloader, Bootloader :: GrubCC ) {
1387+ root_setup
1388+ . physical_root
1389+ . remove_dir_all ( "boot/grub2" )
1390+ . context ( "removing grub2" ) ?;
1391+
1392+ let ( os_id, ..) = parse_os_release ( mounted_root. dir ( ) ) ?
1393+ . ok_or_else ( || anyhow:: anyhow!( "Failed to parse os-release" ) ) ?;
1394+
1395+ let dir = format ! ( "EFI/{os_id}" ) ;
1396+
1397+ // Files are in EFI/<os-name>/
1398+ let efis_dir = mounted_root
1399+ . open_esp_dir ( )
1400+ . context ( "opening esp" ) ?
1401+ . open_dir ( & dir)
1402+ . with_context ( || format ! ( "Opening {dir}" ) ) ?;
1403+
1404+ efis_dir
1405+ . remove_file_optional ( "bootuuid.cfg" )
1406+ . context ( "Removing bootuuid.cfg" ) ?;
1407+ efis_dir
1408+ . remove_file_optional ( "grub.cfg" )
1409+ . context ( "Removing grub.cfg" ) ?;
1410+
1411+ mounted_root
1412+ . dir ( )
1413+ . copy ( "usr/lib/grub-cc/grubx64-cc.efi" , & efis_dir, "grubx64.efi" )
1414+ . context ( "Copying grub-cc binary" ) ?;
1415+ }
13791416 } else {
13801417 crate :: bootloader:: install_systemd_boot (
13811418 & mounted_root,
0 commit comments