From: Michael Tremer Date: Fri, 20 Jul 2018 11:59:00 +0000 (+0000) Subject: installer: Run install-bootloader script instead of own code X-Git-Tag: v2.21-core124~77^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12034118dd0cf631efef85edc5d0944055a7ef5f;p=ipfire-2.x.git installer: Run install-bootloader script instead of own code This allows us to keep the GRUB installation routine in one place only. Signed-off-by: Michael Tremer --- diff --git a/src/installer/hw.c b/src/installer/hw.c index 3bd7480363..c9b95017d3 100644 --- a/src/installer/hw.c +++ b/src/installer/hw.c @@ -78,11 +78,6 @@ struct hw* hw_init() { if (ret == 0) snprintf(hw->arch, sizeof(hw->arch), "%s", uname_data.machine); - // Detect if we are running in EFI mode - ret = access("/sys/firmware/efi", R_OK); - if (ret == 0) - hw->efi_supported = 1; - // Should we install in EFI mode? if ((strcmp(hw->arch, "x86_64") == 0) || (strcmp(hw->arch, "aarch64") == 0)) hw->efi = 1; @@ -1041,47 +1036,9 @@ int hw_stop_all_raid_arrays(const char* output) { int hw_install_bootloader(struct hw* hw, struct hw_destination* dest, const char* output) { char cmd[STRING_SIZE]; - 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; - } - } - // Generate configuration file - snprintf(cmd, sizeof(cmd), "/usr/sbin/grub-mkconfig -o /boot/grub/grub.cfg"); - r = system_chroot(output, DESTINATION_MOUNT_PATH, cmd); + snprintf(cmd, sizeof(cmd), "/usr/bin/install-bootloader %s", dest->path); + int r = system_chroot(output, DESTINATION_MOUNT_PATH, cmd); if (r) return r; diff --git a/src/installer/hw.h b/src/installer/hw.h index 4e0afc4314..9fe69271e6 100644 --- a/src/installer/hw.h +++ b/src/installer/hw.h @@ -63,9 +63,6 @@ struct hw { // Enabled if we should install in EFI mode int efi; - - // Enabled if this system supports EFI - int efi_supported; }; struct hw_disk {