shim/shim.spec

148 lines
4.4 KiB
RPMSpec

#
# spec file for package shim
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%undefine _debuginfo_subpackages
%undefine _build_create_debug
# Move 'efi'-executables to '/usr/share/efi' (FATE#326960, bsc#1166523)
%define sysefibasedir %{_datadir}/efi
%define sysefidir %{sysefibasedir}/%{_target_cpu}
%if 0%{?suse_version} < 1600
%ifarch x86_64
# provide compatibility sym-link for residual kiwi, etc.
%define shim_lib64_share_compat 1
%endif
%endif
Name: shim
Version: 15.8
Release: 0
Summary: UEFI shim loader
License: BSD-2-Clause
Group: System/Boot
URL: https://github.com/rhboot/shim
Source: shim-15.8-150300.4.20.2.x86_64.rpm
Source1: shim-debuginfo-15.8-150300.4.20.2.x86_64.rpm
Source2: shim-debugsource-15.8-150300.4.20.2.x86_64.rpm
Source3: shim-15.8-150300.4.20.2.aarch64.rpm
Source4: shim-debuginfo-15.8-150300.4.20.2.aarch64.rpm
Source5: shim-debugsource-15.8-150300.4.20.2.aarch64.rpm
Source6: shim-install
#BuildRequires: shim-susesigned
BuildRequires: fde-tpm-helper-rpm-macros
BuildRequires: update-bootloader-rpm-macros
Requires: perl-Bootloader
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# For shim-install script
Requires: grub2-efi
%if 0%{?fde_tpm_update_requires:1}
%fde_tpm_update_requires
%endif
ExclusiveArch: x86_64 aarch64
%description
shim is a trivial EFI application that, when run, attempts to open and
execute another application.
%package debuginfo
Summary: UEFI shim loader - debug symbols
Group: Development/Debug
%description debuginfo
The debug symbols of UEFI shim loader
%package debugsource
Summary: UEFI shim loader - debug source
Group: Development/Debug
%description debugsource
The source code of UEFI shim loader
%prep
%ifarch x86_64
rpm2cpio %{SOURCE0} | cpio --extract --unconditional --preserve-modification-time --make-directories
rpm2cpio %{SOURCE1} | cpio --extract --unconditional --preserve-modification-time --make-directories
rpm2cpio %{SOURCE2} | cpio --extract --unconditional --preserve-modification-time --make-directories
%endif
%ifarch aarch64
rpm2cpio %{SOURCE3} | cpio --extract --unconditional --preserve-modification-time --make-directories
rpm2cpio %{SOURCE4} | cpio --extract --unconditional --preserve-modification-time --make-directories
rpm2cpio %{SOURCE5} | cpio --extract --unconditional --preserve-modification-time --make-directories
%endif
%build
%install
# purely repackaged
cp -a * %{buildroot}
%if %{defined shim_lib64_share_compat}
echo old
%else
rm -rf %{buildroot}/usr/lib64/efi
%endif
# also copy over the susesigned shim
# we did this to shortcut some cert work in 15-sp2, we currently do not need it
#install -m 444 %{sysefidir}/shim-susesigned.* %{buildroot}/%{sysefidir}
# Install the updated shim-install
install -m 755 %{SOURCE6} %{buildroot}/%{_sbindir}
%post
%if 0%{?fde_tpm_update_post:1}
%fde_tpm_update_post shim
%endif
%if 0%{?update_bootloader_check_type_reinit_post:1}
%update_bootloader_check_type_reinit_post grub2-efi
%else
/sbin/update-bootloader --reinit || true
%endif
%posttrans
%{?update_bootloader_posttrans}
%{?fde_tpm_update_posttrans}
%files
%defattr(-,root,root)
%dir %{?sysefibasedir}
%dir %{sysefidir}
%{sysefidir}/shim.efi
%{sysefidir}/shim-*.efi
%{sysefidir}/shim-*.der
%{sysefidir}/MokManager.efi
%{sysefidir}/fallback.efi
%{_sbindir}/shim-install
%dir %{_sysconfdir}/uefi/
%dir %{_sysconfdir}/uefi/certs/
%{_sysconfdir}/uefi/certs/*.crt
%if %{defined shim_lib64_share_compat}
# provide compatibility sym-link for previous kiwi, etc.
%dir /usr/lib64/efi
/usr/lib64/efi/*.efi
%endif
/usr/share/doc/packages/shim
%files debuginfo
/usr/lib/debug/%{sysefidir}/*.debug
%files debugsource
%dir /usr/src/debug/shim-*
/usr/src/debug/shim-*/*
%changelog