From a7bfd221b5c1fd1e7437000d53e8dad47eca4a07 Mon Sep 17 00:00:00 2001 From: Yuriy Kohut Date: Tue, 3 Dec 2024 10:57:19 +0200 Subject: [PATCH] Update ELevate vendors patch: - add_arm_bootloader_workaround, remove_upgrade_efi_entry: use specific to particular OS, EFI directory location path, like /boot/efi/EFI/$distro_dir - remove_upgrade_efi_entry: reload EFI info, boot order has changed as Leapp upgrade efi entry was removed The package .spec: bump release --- SOURCES/leapp-repository-0.21.0-elevate.patch | 78 +++++++++++++++++++ SPECS/leapp-repository.spec | 7 +- 2 files changed, 84 insertions(+), 1 deletion(-) diff --git a/SOURCES/leapp-repository-0.21.0-elevate.patch b/SOURCES/leapp-repository-0.21.0-elevate.patch index 945f7ab..54ce343 100644 --- a/SOURCES/leapp-repository-0.21.0-elevate.patch +++ b/SOURCES/leapp-repository-0.21.0-elevate.patch @@ -5626,3 +5626,81 @@ index 00000000..014b7afb + +class VendorTopic(Topic): + name = 'vendor_topic' +diff --git a/repos/system_upgrade/el8toel9/actors/addarmbootloaderworkaround/libraries/addupgradebootloader.py b/repos/system_upgrade/el8toel9/actors/addarmbootloaderworkaround/libraries/addupgradebootloader.py +index 5e9bf5c6..eb5636c9 100644 +--- a/repos/system_upgrade/el8toel9/actors/addarmbootloaderworkaround/libraries/addupgradebootloader.py ++++ b/repos/system_upgrade/el8toel9/actors/addarmbootloaderworkaround/libraries/addupgradebootloader.py +@@ -15,6 +15,23 @@ from leapp.libraries.common.grub import ( + from leapp.libraries.stdlib import api, CalledProcessError, run + from leapp.models import ArmWorkaroundEFIBootloaderInfo, EFIBootEntry, TargetUserSpaceInfo + ++dirname = { ++ 'AlmaLinux': 'almalinux', ++ 'CentOS Linux': 'centos', ++ 'CentOS Stream': 'centos', ++ 'Oracle Linux Server': 'redhat', ++ 'Red Hat Enterprise Linux': 'redhat', ++ 'Rocky Linux': 'rocky', ++ 'Scientific Linux': 'redhat', ++ 'EuroLinux': 'eurolinux', ++} ++ ++with open('/etc/system-release', 'r') as sr: ++ release_line = next(line for line in sr if 'release' in line) ++ distro = release_line.split(' release ', 1)[0] ++ ++distro_dir = dirname.get(distro, 'default') ++ + UPGRADE_EFI_ENTRY_LABEL = 'Leapp Upgrade' + + ARM_SHIM_PACKAGE_NAME = 'shim-aa64' +@@ -22,7 +39,7 @@ ARM_GRUB_PACKAGE_NAME = 'grub2-efi-aa64' + + EFI_MOUNTPOINT = '/boot/efi/' + LEAPP_EFIDIR_CANONICAL_PATH = os.path.join(EFI_MOUNTPOINT, 'EFI/leapp/') +-RHEL_EFIDIR_CANONICAL_PATH = os.path.join(EFI_MOUNTPOINT, 'EFI/redhat/') ++RHEL_EFIDIR_CANONICAL_PATH = os.path.join(EFI_MOUNTPOINT, 'EFI/', distro_dir) + + CONTAINER_DOWNLOAD_DIR = '/tmp_pkg_download_dir' + +diff --git a/repos/system_upgrade/el8toel9/actors/removeupgradeefientry/libraries/removeupgradeefientry.py b/repos/system_upgrade/el8toel9/actors/removeupgradeefientry/libraries/removeupgradeefientry.py +index 3ff3ead9..3d93f6fd 100644 +--- a/repos/system_upgrade/el8toel9/actors/removeupgradeefientry/libraries/removeupgradeefientry.py ++++ b/repos/system_upgrade/el8toel9/actors/removeupgradeefientry/libraries/removeupgradeefientry.py +@@ -6,9 +6,26 @@ from leapp.libraries.common.grub import GRUB2_BIOS_ENTRYPOINT, GRUB2_BIOS_ENV_FI + from leapp.libraries.stdlib import api, CalledProcessError, run + from leapp.models import ArmWorkaroundEFIBootloaderInfo + ++dirname = { ++ 'AlmaLinux': 'almalinux', ++ 'CentOS Linux': 'centos', ++ 'CentOS Stream': 'centos', ++ 'Oracle Linux Server': 'redhat', ++ 'Red Hat Enterprise Linux': 'redhat', ++ 'Rocky Linux': 'rocky', ++ 'Scientific Linux': 'redhat', ++ 'EuroLinux': 'eurolinux', ++} ++ ++with open('/etc/system-release', 'r') as sr: ++ release_line = next(line for line in sr if 'release' in line) ++ distro = release_line.split(' release ', 1)[0] ++ ++distro_dir = dirname.get(distro, 'default') ++ + EFI_MOUNTPOINT = '/boot/efi/' + LEAPP_EFIDIR_CANONICAL_PATH = os.path.join(EFI_MOUNTPOINT, 'EFI/leapp/') +-RHEL_EFIDIR_CANONICAL_PATH = os.path.join(EFI_MOUNTPOINT, 'EFI/redhat/') ++RHEL_EFIDIR_CANONICAL_PATH = os.path.join(EFI_MOUNTPOINT, 'EFI/', distro_dir) + + + def get_workaround_efi_info(): +@@ -54,6 +71,8 @@ def remove_upgrade_efi_entry(): + except CalledProcessError: + api.current_logger().warning('Unable to remove Leapp upgrade efi files.') + ++ # Reload EFI info, boot order has changed as Leapp upgrade efi entry was removed ++ bootloader_info = get_workaround_efi_info() + original_boot_number = bootloader_info.original_entry.boot_number + run(['/usr/sbin/efibootmgr', '--bootnext', original_boot_number]) + diff --git a/SPECS/leapp-repository.spec b/SPECS/leapp-repository.spec index 54e87c2..82979ba 100644 --- a/SPECS/leapp-repository.spec +++ b/SPECS/leapp-repository.spec @@ -53,7 +53,7 @@ py2_byte_compile "%1" "%2"} Epoch: 1 Name: leapp-repository Version: 0.21.0 -Release: 4%{?dist}.elevate.1 +Release: 4%{?dist}.elevate.2 Summary: Repositories for leapp License: ASL 2.0 @@ -402,6 +402,11 @@ done; # no files here %changelog +* Tue Dec 03 2024 Yuriy Kohut - 0.21.0-4.elevate.2 +- Update ELevate patch: + - add_arm_bootloader_workaround, remove_upgrade_efi_entry: use specific to particular OS, EFI directory location path, like /boot/efi/EFI/$distro_dir + - remove_upgrade_efi_entry: reload EFI info, boot order has changed as Leapp upgrade efi entry was removed + * Tue Nov 26 2024 Yuriy Kohut - 0.21.0-4.elevate.1 - Update ELevate patch: - remove 0006-ReadOfKernelArgsError-fix-the-error.patch code as it is already on upstream