Skip to content

Commit

Permalink
🧹 utils: refactor grub efi using native calls
Browse files Browse the repository at this point in the history
  • Loading branch information
vnepogodin committed Jul 28, 2024
1 parent bac052c commit 957b216
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1046,9 +1046,16 @@ pacman -S --noconfirm --needed grub efibootmgr dosfstools grub-btrfs grub-hook
if (!as_default) { return; }
/* clang-format on */

utils::arch_chroot(fmt::format(FMT_COMPILE("mkdir -p {}/EFI/boot"), uefi_mount), false);
spdlog::info("Grub efi binary status:(EFI/cachyos/grubx64.efi): {}", fs::exists(fmt::format(FMT_COMPILE("{0}/EFI/cachyos/grubx64.efi"), uefi_mount)));
utils::arch_chroot(fmt::format(FMT_COMPILE("cp -r {0}/EFI/cachyos/grubx64.efi {0}/EFI/boot/bootx64.efi"), uefi_mount), false);
// create efi directories
const auto& boot_mountpoint = fmt::format(FMT_COMPILE("{}{}"), mountpoint, uefi_mount);
fs::create_directories(fmt::format(FMT_COMPILE("{}/EFI/boot"), boot_mountpoint), err);

const auto& efi_cachyos_grub_file = fmt::format(FMT_COMPILE("{}/EFI/cachyos/grubx64.efi"), boot_mountpoint);
spdlog::info("Grub efi binary status:(EFI/cachyos/grubx64.efi): {}", fs::exists(efi_cachyos_grub_file));

// copy cachyos efi as default efi
const auto& default_efi_grub_file = fmt::format(FMT_COMPILE("{}/EFI/boot/bootx64.efi"), boot_mountpoint);
fs::copy_file(efi_cachyos_grub_file, default_efi_grub_file, fs::copy_options::overwrite_existing);
#endif
}

Expand Down

0 comments on commit 957b216

Please sign in to comment.