summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2024-01-04 17:17:19 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2024-01-04 21:34:43 +0100
commit77cc147f451be2508163eec9fb1447fd75ca898f (patch)
treebdf23c54dae7fbb22884b6bedd20eda4f7edf37e
parentd1a478f3891a0a5e0c9b11fac1e5c111d77f0d85 (diff)
downloaddrakx-77cc147f451be2508163eec9fb1447fd75ca898f.tar
drakx-77cc147f451be2508163eec9fb1447fd75ca898f.tar.gz
drakx-77cc147f451be2508163eec9fb1447fd75ca898f.tar.bz2
drakx-77cc147f451be2508163eec9fb1447fd75ca898f.tar.xz
drakx-77cc147f451be2508163eec9fb1447fd75ca898f.zip
(get_grub2_pkg) split it out
-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;