From ccaf22f44fd80639a107d27b1cfff81bedc78b31 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 15 Jan 2026 12:52:07 -0500 Subject: [PATCH] Add architecture handling in pkglist To handle amd64/arm64 profiles, have the pkglist allow for architecture specific qualifiers. Additionally, soften failure to accomplish selinux changes. --- imgutil/el10/pkglist | 6 +++++- imgutil/el9/pkglist | 7 ++++++- imgutil/imgutil | 18 ++++++++++++++++-- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/imgutil/el10/pkglist b/imgutil/el10/pkglist index 56acdd23..0bee79dd 100644 --- a/imgutil/el10/pkglist +++ b/imgutil/el10/pkglist @@ -19,4 +19,8 @@ fuse-libs libnl3 dhcpcd openssh-keysign -chrony kernel net-tools nfs-utils openssh-server rsync tar util-linux python3 tar dracut dracut-network ethtool parted openssl openssh-clients bash vim-minimal rpm iputils lvm2 efibootmgr shim-x64.x86_64 grub2-efi-x64 attr +chrony kernel net-tools nfs-utils openssh-server rsync tar util-linux python3 tar dracut dracut-network ethtool parted openssl openssh-clients bash vim-minimal rpm iputils lvm2 efibootmgr attr +%onlyarch x86_64 +shim-x64.x86_64 grub2-efi-x64 +%onlyarch aarch64 +shim-aa64.aarch64 grub2-efi-aa64 \ No newline at end of file diff --git a/imgutil/el9/pkglist b/imgutil/el9/pkglist index 8fc1dbf4..44eaaf6d 100644 --- a/imgutil/el9/pkglist +++ b/imgutil/el9/pkglist @@ -1,3 +1,4 @@ +system-release dnf hostname irqbalance @@ -17,4 +18,8 @@ xfsprogs e2fsprogs fuse-libs libnl3 -chrony kernel net-tools nfs-utils openssh-server rsync tar util-linux python3 tar dracut dracut-network ethtool parted openssl dhclient openssh-clients bash vim-minimal rpm iputils lvm2 efibootmgr shim-x64.x86_64 grub2-efi-x64 attr +chrony kernel net-tools nfs-utils openssh-server rsync tar util-linux python3 tar dracut dracut-network ethtool parted openssl dhclient openssh-clients bash vim-minimal rpm iputils lvm2 efibootmgr attr +%onlyarch x86_64 +shim-x64.x86_64 grub2-efi-x64 +%onlyarch aarch64 +shim-aa64.aarch64 grub2-efi-aa64 \ No newline at end of file diff --git a/imgutil/imgutil b/imgutil/imgutil index 0c44d8ee..acc9e0f4 100644 --- a/imgutil/imgutil +++ b/imgutil/imgutil @@ -519,9 +519,18 @@ class OsHandler(object): pkglistfile = pkglistfile[:-1] with open(pkglistfile, 'r') as pkglist: pkgs = '' + ignoremode = False for line in pkglist.readlines(): line = line.split('#', 1)[0].strip() - pkgs += line + ' ' + if line.startswith(r'%onlyarch '): + archs = line[len(r'%onlyarch '):].split() + if self.arch not in archs: + ignoremode = True + else: + ignoremode = False + continue + if not ignoremode: + pkgs += line + ' ' pkgs = pkgs.split() retpkgs = [] for pkg in pkgs: @@ -764,7 +773,12 @@ class ElHandler(OsHandler): if line.startswith('selinuxfs '): break else: - self.relabel_targdir() + try: + self.relabel_targdir() + except subprocess.CalledProcessError: + # Some filesystem contexts can not accommodate the selinux labels, warn that + # this failed, but allow it to proceed in case it can boot anyway + sys.stderr.write('Warning: could not relabel target filesystem for SELinux\n') def relabel_targdir(self): subprocess.check_call(