From 95b705797d4f5eb3c3102633baa87e72d3affd34 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 25 May 2019 11:42:54 +0100 Subject: On systems with 32-bit EFI, enable the Core 32bit media by default. --- NEWS | 2 ++ urpm/media.pm | 14 ++++++++++++-- urpm/util.pm | 11 +++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 3a6cd6ca..597398a9 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ - don't enable 32-bit media by default on 64-bit systems (mga#24376) + o except on systems with 32-bit EFI, where we need the Core 32bit + media for the bootloader Version 8.115 - 1 May 2019 diff --git a/urpm/media.pm b/urpm/media.pm index 62a5d5d3..cadfc173 100644 --- a/urpm/media.pm +++ b/urpm/media.pm @@ -4,7 +4,7 @@ package urpm::media; use strict; use urpm qw(file_from_local_medium is_local_medium); use urpm::msg; -use urpm::util qw(any append_to_file basename cat_ difference2 dirname intersection member output_safe begins_with copy_and_own file_size offset_pathname reduce_pathname); +use urpm::util qw(any append_to_file basename cat_ difference2 dirname intersection member output_safe begins_with copy_and_own file_size offset_pathname reduce_pathname uefi_type); use urpm::removable; use urpm::lock; use urpm::md5sum; @@ -784,13 +784,13 @@ sub is_media_to_add_by_default { my $add_by_default = !$distribconf->getvalue($medium, 'noauto'); my @media_types = split(':', $distribconf->getvalue($medium, 'media_type')); return $add_by_default if !@media_types; + my $non_regular_medium = intersection(\@media_types, [ qw(backports debug source testing) ]); if ($product_id->{product} eq 'Free') { if (member('non-free', @media_types)) { $urpm->{log}(N("ignoring non-free medium `%s'", $medium)); $add_by_default = 0; } } else { - my $non_regular_medium = intersection(\@media_types, [ qw(backports debug source testing) ]); if (!$add_by_default && !$non_regular_medium) { my $medium_name = $distribconf->getvalue($medium, 'name') || ''; # Don't enable 32-bit media by default on 64-bit systems (mga#24376). '32bit' only appears @@ -805,6 +805,16 @@ sub is_media_to_add_by_default { } } } + if ($distribconf->getvalue('media_info', 'arch') eq 'x86_64' && uefi_type() eq 'ia32') { + if (!$add_by_default && !$non_regular_medium) { + my $medium_name = $distribconf->getvalue($medium, 'name') || ''; + # Enable 32-bit media by default to allow 32-bit grub2-efi to be installed/updated. + if ($medium_name =~ /Core/ && $medium_name =~ /32bit/) { + $add_by_default = 1; + $urpm->{log}(N("un-ignoring 32bit medium `%s' b/c system is 32-bit EFI", $medium_name)); + } + } + } $add_by_default; } diff --git a/urpm/util.pm b/urpm/util.pm index c786227b..4dbad1cc 100644 --- a/urpm/util.pm +++ b/urpm/util.pm @@ -30,6 +30,7 @@ our @EXPORT = qw(add2hash_ reduce_pathname remove_internal_name same_size_and_mtime + uefi_type uniq uniq_ unquotespace @@ -215,6 +216,16 @@ sub append_to_file { 1; } +#- return the UEFI machine type short name +sub uefi_type() { + if (-e '/sys/firmware/efi/fw_platform_size') { + # No support for ARM yet + cat_('/sys/firmware/efi/fw_platform_size') =~ /32/ ? 'ia32' : 'x64'; + } else { + 'none'; + } +} + 1; -- cgit v1.2.1