kernel.spec: Fix UKI naming to comply with BLS

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2187671
Upstream Status: RHEL-only

ARK: 4359f657a649 ("kernel.spec: Fix UKI naming to comply with BLS")

The Boot Loader Specification (BLS) [1] suggests that type #2 entries (UKIs)
shall have the same names like type #1 entries with the exception of
the suffix being .efi instead of .conf. In particular this means that
the name for installed UKIs should be
<entry-token-or-machine-id>-<version>.efi. The same naming convention is
used by kernel-installs 90-uki-copy.install [2] in systemd v253.

Adjust the workaround to install UKIs in the kernel.spec to follow the
same naming convention in order to prevent breaking user space tools
that rely on it.

[1] https://uapi-group.org/specifications/specs/boot_loader_specification/
[2] https://github.com/systemd/systemd/blob/v253/src/kernel-install/90-uki-copy.install

Signed-off-by: Philipp Rudo <prudo@redhat.com>
This commit is contained in:
Philipp Rudo 2023-03-30 11:44:38 +02:00
parent 994bc050e6
commit 3b7ff08c71
1 changed files with 5 additions and 3 deletions

View File

@ -3237,10 +3237,12 @@ touch %{_localstatedir}/lib/rpm-state/%{name}/installing_core_%{KVERREL}%{?-v:+%
%define kernel_uki_virt_scripts() \
%{expand:%%posttrans %{?1:%{1}-}uki-virt}\
mkdir -p /boot/efi/EFI/Linux\
cp /lib/modules/%{KVERREL}%{?1:+%{1}}/vmlinuz-virt.efi /boot/efi/EFI/Linux/vmlinuz-%{KVERREL}%{?1:+%{1}}-virt.efi\
entry_token=$(kernel-install inspect | grep KERNEL_INSTALL_ENTRY_TOKEN: | cut -d ' ' -f2)\
cp /lib/modules/%{KVERREL}%{?1:+%{1}}/vmlinuz-virt.efi /boot/efi/EFI/Linux/${entry_token}-%{KVERREL}%{?1:+%{1}}.efi\
%{nil}\
%{expand:%%postun %{?1:%{1}-}uki-virt}\
rm -f /boot/efi/EFI/Linux/vmlinuz-%{KVERREL}%{?1:+%{1}}-virt.efi\
entry_token=$(kernel-install inspect | grep KERNEL_INSTALL_ENTRY_TOKEN: | cut -d ' ' -f2)\
rm -f /boot/efi/EFI/Linux/${entry_token}-%{KVERREL}%{?1:+%{1}}.efi\
%{nil}
#
@ -3539,7 +3541,7 @@ fi
%if "%{3}" != "rt" && "%{3}" != "rt-debug"\
%{expand:%%files %{?3:%{3}-}uki-virt}\
/lib/modules/%{KVERREL}%{?3:+%{3}}/%{?-k:%{-k*}}%{!?-k:vmlinuz}-virt.efi\
%ghost /%{image_install_path}/efi/EFI/Linux/%{?-k:%{-k*}}%{!?-k:vmlinuz}-%{KVERREL}%{?3:+%{3}}-virt.efi\
%ghost /%{image_install_path}/efi/EFI/Linux/%{?-k:%{-k*}}%{!?-k:*}-%{KVERREL}%{?3:+%{3}}.efi\
%endif\
%endif\
%if %{?3:1} %{!?3:0}\