Skip to content

Commit

Permalink
Merge pull request #132 from yuravk/almalinux-ng-0.21.0
Browse files Browse the repository at this point in the history
Vendors support in workaround for ARM upgrades from EL8 to EL9.5
  • Loading branch information
andrewlukoshko authored Dec 3, 2024
2 parents aafe50f + 0d12a80 commit d7989a1
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,31 @@
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'
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'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,26 @@
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():
Expand Down Expand Up @@ -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])

Expand Down

0 comments on commit d7989a1

Please sign in to comment.