From 0baa58de6ff2b3ea3ebe6e09035a9643af4e0768 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sun, 21 Jun 2020 10:41:27 +0100 Subject: Simplify UEFI bootloader detection. --- perl-install/bootloader.pm | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 2d2b9c540..4e8fba097 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -296,8 +296,17 @@ sub read { @devs = split(',', $bootloader->{'raid-extra-boot'}); } + #- if $bootloader->{boot} is undefined, @devs contains a single undef element my ($type) = map { - if (m!/fd\d+$!) { + if (is_uefi()) { + if (-e "$::prefix/boot/refind_linux.conf") { + 'refind'; + } elsif (-f "$::prefix/boot/EFI/EFI/mageia/grub" . uefi_type() . ".efi") { + 'grub2'; + } else { + () + } + } elsif (m!/fd\d+$!) { warn "not checking the method on floppy, assuming $main_method is right\n"; $main_method; } elsif (member($main_method, qw(cromwell uboot))) { @@ -306,8 +315,6 @@ sub read { } elsif (my $type = partition_table::raw::typeOfMBR($_)) { warn "typeOfMBR $type on $_ for method $main_method\n" if $ENV{DEBUG}; $type; - } elsif (-e "$::prefix/boot/refind_linux.conf") { - 'refind'; } else { () } } @devs; @@ -315,13 +322,6 @@ sub read { return $bootloader if read_($bootloader); } } - # still no boot loader found? let's check for ESP if using UEFI: - if (is_uefi()) { - if (-f "/boot/EFI/EFI/mageia/grubx64.efi" || -f "/boot/EFI/EFI/mageia/grubia32.efi" || -f "/boot/efi/EFI/mageia/grubaa64.efi") { - my $bootloader = bootloader::read_grub2(); - return $bootloader if read_($bootloader); - } - } } sub read_ { -- cgit v1.2.1