- int r;
-
- char cmd_grub[STRING_SIZE];
- snprintf(cmd_grub, sizeof(cmd_grub), "/usr/sbin/grub-install --target=i386-pc"
- " --no-floppy --recheck");
-
- if (dest->is_raid) {
- snprintf(cmd, sizeof(cmd), "%s %s", cmd_grub, dest->disk1->path);
- r = system_chroot(output, DESTINATION_MOUNT_PATH, cmd);
- if (r)
- return r;
-
- snprintf(cmd, sizeof(cmd), "%s %s", cmd_grub, dest->disk2->path);
- r = system_chroot(output, DESTINATION_MOUNT_PATH, cmd);
- if (r)
- return r;
- } else {
- snprintf(cmd, sizeof(cmd), "%s %s", cmd_grub, dest->path);
- r = system_chroot(output, DESTINATION_MOUNT_PATH, cmd);
- if (r)
- return r;
- }
-
- // Install GRUB in EFI mode
- if (hw->efi) {
- for (int removable = 0; removable < 1; removable++) {
- snprintf(cmd, sizeof(cmd), "/usr/sbin/grub-install"
- " --target=%s-efi --efi-directory=%s %s %s",
- hw->arch, HW_PATH_BOOT_EFI,
- (hw->efi_supported) ? "" : "--no-nvram",
- (removable) ? "--removable" : "");
-
- r = system_chroot(output, DESTINATION_MOUNT_PATH, cmd);
- if (r)
- return r;
- }
- }