summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/bootloader.pm25
1 files changed, 15 insertions, 10 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index ad7850d40..d1d757c3d 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -2637,6 +2637,20 @@ sub install {
run_program::run('umount', $efivars) if is_uefi() && !$already_mounted;
}
+sub get_grub2_pkg() {
+ my ($prefix, $pkg);
+ if (is_uefi()) {
+ my %convert = (ia32 => 'i386', aa64 => 'arm64', x64 => 'x86_64');
+ my %pkgs = (ia32 => 'x86-32', aa64 => 'aarch-64', x64 => 'x86-64');
+ $prefix = $convert{uefi_type()} . "-efi";
+ $pkg = "grub2-efi(" . $pkgs{uefi_type()} . ")";
+ } else {
+ $prefix = 'i386-pc';
+ $pkg = 'grub2';
+ }
+ ($prefix, $pkg);
+}
+
sub ensure_pkg_is_installed {
my ($do_pkgs, $bootloader) = @_;
@@ -2647,16 +2661,7 @@ sub ensure_pkg_is_installed {
);
my $main_method = main_method($bootloader->{method});
if ($main_method eq 'grub2') {
- my ($prefix, $pkg);
- if (is_uefi()) {
- my %convert = (ia32 => 'i386', aa64 => 'arm64', x64 => 'x86_64');
- my %pkgs = (ia32 => 'x86-32', aa64 => 'aarch-64', x64 => 'x86-64');
- $prefix = $convert{uefi_type()} . "-efi";
- $pkg = "grub2-efi(" . $pkgs{uefi_type()} . ")";
- } else {
- $prefix = 'i386-pc';
- $pkg = 'grub2';
- }
+ my ($prefix, $pkg) = get_grub2_pkg();
$do_pkgs->ensure_is_installed($pkg, "/usr/lib/grub/$prefix/ext2.mod", 1) or return 0;
} elsif ($main_method eq 'refind') {
$do_pkgs->ensure_is_installed('refind', '/sbin/refind-install', 1) or return 0;