Accepting request 668950 from devel:openSUSE:Factory

OBS-URL: https://build.opensuse.org/request/show/668950
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/shim?expand=0&rev=72
This commit is contained in:
Stephan Kulow 2019-02-02 20:44:39 +00:00 committed by Git OBS Bridge
commit 78a2ca36f6
3 changed files with 81 additions and 25 deletions

View File

@ -1,5 +1,6 @@
#! /bin/bash -e
arch=`uname -m`
rootdir=
bootdir=
efidir=
@ -10,8 +11,9 @@ no_nvram=no
removable=no
clean=no
sysconfdir="/etc"
libdir="/usr/lib64"
source_dir="$libdir/efi"
libdir="/usr/lib64" # Beware, this is arch dependent!
datadir="/usr/share"
source_dir="${data_dir}/efi/${arch}"
grub_probe="/usr/sbin/grub2-probe"
grub_mkrelpath="/usr/bin/grub2-mkrelpath"
grub_install="/usr/sbin/grub2-install"
@ -22,7 +24,6 @@ update_boot=no
def_grub_efi="${source_dir}/grub.efi"
def_boot_efi=
arch=`uname -m`
if [ x${arch} = xx86_64 ] ; then
grub_install_target="x86_64-efi"
def_boot_efi="bootx64.efi"
@ -34,6 +35,12 @@ else
exit 1
fi
if [ ! -d "${source_dir}" -o ! -e "${def_grub_efi}" ] ; then
# for outdated packages fall back to previous behavior
source_dir="$libdir/efi"
def_grub_efi="${source_dir}/grub.efi"
fi
# Get GRUB_DISTRIBUTOR.
if test -f "${sysconfdir}/default/grub" ; then
. "${sysconfdir}/default/grub"
@ -332,7 +339,10 @@ if test "$no_nvram" = no && test -n "$bootloader_id"; then
efidir_disk="$("$grub_probe" --target=disk --device-map= "$efidir")"
if test -z "$efidir_drive" || test -z "$efidir_disk"; then
echo "Can't find GRUB drive for $efidir; unable to create EFI Boot Manager entry." >&2
elif [[ "$efidir_drive" == \(mduuid/* ]]; then
# bsc#1119762 If the MD device is partitioned, we just need to create one
# boot entry since the partitions are nested partitions and the mirrored
# partitions share the same UUID.
elif [[ "$efidir_drive" == \(mduuid/* && "$efidir_drive" != \(mduuid/*,* ]]; then
eval $(mdadm --detail --export "$efidir_disk" |
perl -ne 'print if m{^MD_LEVEL=}; push( @D, $1) if (m{^MD_DEVICE_\S+_DEV=(\S+)$});
sub END() {print "MD_DEVS=\"", join( " ", @D), "\"\n";};')

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Mon Jan 28 03:18:53 UTC 2019 - Gary Ching-Pang Lin <glin@suse.com>
- Amend shim.spec to remove $RPM_BUILD_ROOT
-------------------------------------------------------------------
Thu Jan 17 17:12:14 UTC 2019 - rw@suse.com
- Move 'efi'-executables to '/usr/share/efi' (FATE#326960)
(preparing the move to 'noarch' for this package)
-------------------------------------------------------------------
Mon Jan 14 09:48:59 UTC 2019 - Gary Ching-Pang Lin <glin@suse.com>
- Update shim-install to handle the partitioned MD devices
(bsc#1119762, bsc#1119763)
-------------------------------------------------------------------
Thu Dec 20 04:13:00 UTC 2018 - Gary Ching-Pang Lin <glin@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package shim
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -19,6 +19,17 @@
%undefine _debuginfo_subpackages
%undefine _build_create_debug
%ifarch aarch64
%define grubplatform arm64-efi
%else
%define grubplatform %{_target_cpu}-efi
%endif
%if 0%{?suse_version} > 1500
%define sysefibasedir %{_datadir}/efi
%define sysefidir %{sysefibasedir}/%{_target_cpu}
%else
%define sysefidir /usr/lib64/efi
%endif
Name: shim
Version: 15+git47
@ -71,7 +82,7 @@ Requires: perl-Bootloader
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# For shim-install script
Requires: grub2-efi
Requires: grub2-%{grubplatform}
ExclusiveArch: x86_64 aarch64
%description
@ -103,6 +114,7 @@ The source code of UEFI shim loader
%if 0%{?is_opensuse} == 1
%patch100 -p1
%endif
%build
# first, build MokManager and fallback as they don't depend on a
# specific certificate
@ -211,12 +223,12 @@ find . \( -name "*.c" -o -name "*.h" \) -type f -exec cp --parents -a {} ../sour
mv ../source .
%install
export BRP_PESIGN_FILES='%{_libdir}/efi/shim*.efi %{_libdir}/efi/MokManager.efi %{_libdir}/efi/fallback.efi'
install -d %{buildroot}/%{_libdir}/efi
cp -a shim*.efi %{buildroot}/%{_libdir}/efi
install -m 444 shim-*.der %{buildroot}/%{_libdir}/efi
install -m 644 MokManager.efi %{buildroot}/%{_libdir}/efi/MokManager.efi
install -m 644 fallback.efi %{buildroot}/%{_libdir}/efi/fallback.efi
export BRP_PESIGN_FILES='%{sysefidir}/shim*.efi %{sysefidir}/MokManager.efi %{sysefidir}/fallback.efi'
install -d %{buildroot}/%{sysefidir}
cp -a shim*.efi %{buildroot}/%{sysefidir}
install -m 444 shim-*.der %{buildroot}/%{sysefidir}
install -m 644 MokManager.efi %{buildroot}/%{sysefidir}/MokManager.efi
install -m 644 fallback.efi %{buildroot}/%{sysefidir}/fallback.efi
install -d %{buildroot}/%{_sbindir}
install -m 755 %{SOURCE3} %{buildroot}/%{_sbindir}/
# install SUSE certificate
@ -225,12 +237,21 @@ for file in shim-*.der; do
fpr=$(openssl x509 -sha1 -fingerprint -inform DER -noout -in $file | cut -c 18- | cut -d ":" -f 1,2,3,4 | sed 's/://g')
install -m 644 $file %{buildroot}/%{_sysconfdir}/uefi/certs/${fpr}-shim.crt
done
%if 0%{?suse_version} > 1500 && 0%{?suse_version} < 1600
%ifarch x86_64
if [ "%{sysefidir}" != "/usr/lib64/efi" ]; then
# provide compatibility sym-link for previous kiwi, etc.
install -d %{buildroot}/usr/lib64/efi
ln -srf %{buildroot}/%{sysefidir}/*.efi %{buildroot}/usr/lib64/efi/
fi
%endif
%endif
# install the debug symbols
install -d %{buildroot}/usr/lib/debug/%{_libdir}/efi
install -m 644 shim.debug %{buildroot}/usr/lib/debug/%{_libdir}/efi
install -m 644 MokManager.efi.debug %{buildroot}/usr/lib/debug/%{_libdir}/efi/MokManager.debug
install -m 644 fallback.efi.debug %{buildroot}/usr/lib/debug/%{_libdir}/efi/fallback.debug
install -d %{buildroot}/usr/lib/debug/%{sysefidir}
install -m 644 shim.debug %{buildroot}/usr/lib/debug/%{sysefidir}
install -m 644 MokManager.efi.debug %{buildroot}/usr/lib/debug/%{sysefidir}/MokManager.debug
install -m 644 fallback.efi.debug %{buildroot}/usr/lib/debug/%{sysefidir}/fallback.debug
# install the debug source
install -d %{buildroot}/usr/src/debug/%{name}-%{version}
@ -252,22 +273,30 @@ cp -r source/* %{buildroot}/usr/src/debug/%{name}-%{version}
%files
%defattr(-,root,root)
%doc COPYRIGHT
%dir %{_libdir}/efi
%{_libdir}/efi/shim.efi
%{_libdir}/efi/shim-*.efi
%{_libdir}/efi/shim-*.der
%{_libdir}/efi/MokManager.efi
%{_libdir}/efi/fallback.efi
%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 0%{?suse_version} > 1500 && 0%{?suse_version} < 1600
%ifarch x86_64
# provide compatibility sym-link for previous kiwi, etc.
%dir /usr/lib64/efi
/usr/lib64/efi/*.efi
%endif
%endif
%files -n shim-debuginfo
%defattr(-,root,root,-)
/usr/lib/debug/%{_libdir}/efi/shim.debug
/usr/lib/debug/%{_libdir}/efi/MokManager.debug
/usr/lib/debug/%{_libdir}/efi/fallback.debug
/usr/lib/debug%{sysefidir}/shim.debug
/usr/lib/debug%{sysefidir}/MokManager.debug
/usr/lib/debug%{sysefidir}/fallback.debug
%files -n shim-debugsource
%defattr(-,root,root,-)