From 7d5d4121aba18cd4c53f851365fd039e104e996b2fa5f84b185ef54a50131783 Mon Sep 17 00:00:00 2001 From: Gary Ching-Pang Lin Date: Tue, 11 Aug 2020 07:05:17 +0000 Subject: [PATCH] Accepting request 825701 from home:gary_lin:branches:devel:openSUSE:Factory Update shim to 15+git47-lp152.4.3.1 from openSUSE Leap 15.2 OBS-URL: https://build.opensuse.org/request/show/825701 OBS-URL: https://build.opensuse.org/package/show/devel:openSUSE:Factory/shim-leap?expand=0&rev=25 --- shim-14-lp150.8.5.1.x86_64.rpm | 3 - shim-15+git47-lp152.4.3.1.x86_64.rpm | 3 + shim-install | 382 --------------------------- shim-leap.changes | 7 + shim-leap.spec | 14 +- 5 files changed, 13 insertions(+), 396 deletions(-) delete mode 100644 shim-14-lp150.8.5.1.x86_64.rpm create mode 100644 shim-15+git47-lp152.4.3.1.x86_64.rpm delete mode 100644 shim-install diff --git a/shim-14-lp150.8.5.1.x86_64.rpm b/shim-14-lp150.8.5.1.x86_64.rpm deleted file mode 100644 index f744350..0000000 --- a/shim-14-lp150.8.5.1.x86_64.rpm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9d7ed96e0885a5c18bcc144939a751251ec8503bc353ab86c441f2b4d48fe08c -size 502908 diff --git a/shim-15+git47-lp152.4.3.1.x86_64.rpm b/shim-15+git47-lp152.4.3.1.x86_64.rpm new file mode 100644 index 0000000..77e9207 --- /dev/null +++ b/shim-15+git47-lp152.4.3.1.x86_64.rpm @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:805d90db638ac94e8bb1aac8cc3717cf3ecc761da92b30f14df2063760881603 +size 607804 diff --git a/shim-install b/shim-install deleted file mode 100644 index 212e5a8..0000000 --- a/shim-install +++ /dev/null @@ -1,382 +0,0 @@ -#! /bin/bash -e - -arch=`uname -m` -rootdir= -bootdir= -efidir= -install_device= -efibootdir= -ca_string= -no_nvram=no -removable=no -clean=no -sysconfdir="/etc" -libdir="/usr/lib64" # Beware, this is arch dependent! -datadir="/usr/share" -source_dir="${datadir}/efi/${arch}" -efibootmgr="/usr/sbin/efibootmgr" -grub_probe="/usr/sbin/grub2-probe" -grub_mkrelpath="/usr/bin/grub2-mkrelpath" -grub_install="/usr/sbin/grub2-install" -grub_install_target= -self="`basename $0`" -grub_cfg="/boot/grub2/grub.cfg" -update_boot=no -def_grub_efi="${source_dir}/grub.efi" -def_boot_efi= - -if [ x${arch} = xx86_64 ] ; then - grub_install_target="x86_64-efi" - def_boot_efi="bootx64.efi" -elif [ x${arch} = xaarch64 ] ; then - grub_install_target="arm64-efi" - def_boot_efi="bootaa64.efi" -else - echo "Unsupported architecture: ${arch}" - 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" -fi - -if [ x"${GRUB_DISTRIBUTOR}" = x ] && [ -f "${sysconfdir}/os-release" ] ; then - . "${sysconfdir}/os-release" - GRUB_DISTRIBUTOR="${NAME} ${VERSION}" -fi - -bootloader_id="$(echo "$GRUB_DISTRIBUTOR" | tr 'A-Z' 'a-z' | cut -d' ' -f1)" -if test -z "$bootloader_id"; then - bootloader_id=grub -fi - -efi_distributor="$bootloader_id" -bootloader_id="${bootloader_id}-secureboot" - -case "$bootloader_id" in - "sle"*) - ca_string='SUSE Linux Enterprise Secure Boot CA1';; - "opensuse"*) - ca_string='openSUSE Secure Boot CA1';; - *) ca_string="";; -esac - -usage () { - echo "Usage: $self [OPTION] [INSTALL_DEVICE]" - echo - echo "Install Secure Boot Loaders on your drive." - echo - echo "--directory=DIR use images from DIR." - echo "--grub-probe=FILE use FILE as grub-probe." - echo "--removable the installation device is removable." - echo "--no-nvram don't update the NVRAM variable." - echo "--bootloader-id=ID the ID of bootloader." - echo "--efi-directory=DIR use DIR as the EFI System Partition root." - echo "--config-file=FILE use FILE as config file, default is $grub_cfg." - echo "--clean remove all installed files and configs." - echo "--suse-enable-tpm install grub.efi with TPM support." - echo - echo "INSTALL_DEVICE must be system device filename." -} - -argument () { - opt="$1" - shift - - if test $# -eq 0; then - echo "$0: option requires an argument -- \`$opt'" 1>&2 - exit 1 - fi - echo "$1" -} - -# Check the arguments. -while test $# -gt 0 -do - option=$1 - shift - - case "$option" in - -h | --help) - usage - exit 0 ;; - - --root-directory) - rootdir="`argument $option "$@"`"; shift;; - --root-directory=*) - rootdir="`echo "$option" | sed 's/--root-directory=//'`" ;; - - --efi-directory) - efidir="`argument $option "$@"`"; shift;; - --efi-directory=*) - efidir="`echo "$option" | sed 's/--efi-directory=//'`" ;; - - --directory | -d) - source_dir="`argument $option "$@"`"; shift;; - --directory=*) - source_dir="`echo "$option" | sed 's/--directory=//'`" ;; - - --bootloader-id) - bootloader_id="`argument $option "$@"`"; shift;; - --bootloader-id=*) - bootloader_id="`echo "$option" | sed 's/--bootloader-id=//'`" ;; - - --grub-probe) - grub_probe="`argument "$option" "$@"`"; shift;; - --grub-probe=*) - grub_probe="`echo "$option" | sed 's/--grub-probe=//'`" ;; - - --config-file) - grub_cfg="`argument "$option" "$@"`"; shift;; - --config-file=*) - grub_cfg="`echo "$option" | sed 's/--config-file=//'`" ;; - - --removable) - no_nvram=yes - removable=yes ;; - - --no-nvram) - no_nvram=yes ;; - - --suse-enable-tpm) - # bsc#1174320 shim-install uses wrong paths for EFI files - # There are 3 possible locations of grub-tpm.efi and we will check them - # one by one. - if [ -e "${source_dir}/grub-tpm.efi" ]; then - source_grub_efi="${source_dir}/grub-tpm.efi" - elif [ -e "${datadir}/grub2/${grub_install_target}/grub-tpm.efi" ] ; then - source_grub_efi="${datadir}/grub2/${grub_install_target}/grub-tpm.efi" - else - source_grub_efi="/usr/lib/grub2/${grub_install_target}/grub-tpm.efi" - fi - ;; - - --clean) - clean=yes ;; - - -*) - echo "Unrecognized option \`$option'" 1>&2 - usage - exit 1 - ;; - *) - if test "x$install_device" != x; then - echo "More than one install device?" 1>&2 - usage - exit 1 - fi - install_device="${option}" ;; - esac -done - -if test -n "$efidir"; then - efi_fs=`"$grub_probe" --target=fs "${efidir}"` - if test "x$efi_fs" = xfat; then :; else - echo "$efidir doesn't look like an EFI partition." 1>&2 - efidir= - fi -fi - - -if [ -z "$bootdir" ]; then - bootdir="/boot" - if [ -n "$rootdir" ] ; then - # Initialize bootdir if rootdir was initialized. - bootdir="${rootdir}/boot" - fi -fi - -# Find the EFI System Partition. -if test -n "$efidir"; then - install_device="`"$grub_probe" --target=device --device-map= "${efidir}"`" -else - if test -d "${bootdir}/efi"; then - install_device="`"$grub_probe" --target=device --device-map= "${bootdir}/efi"`" - # Is it a mount point? - if test "x$install_device" != "x`"$grub_probe" --target=device --device-map= "${bootdir}"`"; then - efidir="${bootdir}/efi" - fi - elif test -d "${bootdir}/EFI"; then - install_device="`"$grub_probe" --target=device --device-map= "${bootdir}/EFI"`" - # Is it a mount point? - if test "x$install_device" != "x`"$grub_probe" --target=device --device-map= "${bootdir}"`"; then - efidir="${bootdir}/EFI" - fi - elif test -n "$rootdir" && test "x$rootdir" != "x/"; then - # The EFI System Partition may have been given directly using - # --root-directory. - install_device="`"$grub_probe" --target=device --device-map= "${rootdir}"`" - # Is it a mount point? - if test "x$install_device" != "x`"$grub_probe" --target=device --device-map= "${rootdir}/.."`"; then - efidir="${rootdir}" - fi - fi - - if test -n "$efidir"; then - efi_fs=`"$grub_probe" --target=fs "${efidir}"` - if test "x$efi_fs" = xfat; then :; else - echo "$efidir doesn't look like an EFI partition." 1>&2 - efidir= - fi - fi -fi - -if test -n "$efidir"; then - efi_file=shim.efi - efibootdir="$efidir/EFI/boot" - mkdir -p "$efibootdir" || exit 1 - if test "$removable" = "yes" ; then - efidir="$efibootdir" - else - efidir="$efidir/EFI/$efi_distributor" - mkdir -p "$efidir" || exit 1 - fi -else - echo "No valid EFI partition" 1>&2 - exit 1; -fi - -if test "$removable" = "no" -a -f "$efibootdir/$def_boot_efi"; then - if test -n "$ca_string" && (grep -q "$ca_string" "$efibootdir/$def_boot_efi"); then - update_boot=yes - fi -else - update_boot=yes -fi - -if test "$clean" = "yes"; then - rm -f "${efidir}/shim.efi" - rm -f "${efidir}/MokManager.efi" - rm -f "${efidir}/grub.efi" - rm -f "${efidir}/grub.cfg" - rm -f "${efidir}/boot.csv" - if test "$update_boot" = "yes"; then - rm -f "${efibootdir}/${def_boot_efi}" - rm -f "${efibootdir}/fallback.efi" - fi - if test "$no_nvram" = no && test -n "$bootloader_id"; then - # Delete old entries from the same distributor. - for bootnum in `$efibootmgr | grep '^Boot[0-9]' | \ - fgrep -i " $bootloader_id" | cut -b5-8`; do - $efibootmgr -b "$bootnum" -B - done - fi - exit 0 -fi - -cp "${source_dir}/MokManager.efi" "${efidir}" - -if test -n "$source_grub_efi" && ! test -f "$source_grub_efi"; then - echo "File $source_grub_efi doesn't exist, fallback to default one" 1>&2 - source_grub_efi="" -fi - -if test -z "$source_grub_efi"; then - source_grub_efi="$def_grub_efi" -fi - -echo "copying $source_grub_efi to ${efidir}/grub.efi" -cp "$source_grub_efi" "${efidir}/grub.efi" - -if test "$efidir" != "$efibootdir" ; then - cp "${source_dir}/shim.efi" "${efidir}" - if test -n "$bootloader_id"; then - echo "shim.efi,${bootloader_id}" | iconv -f ascii -t ucs2 > "${efidir}/boot.csv" - fi -fi - -if test "$update_boot" = "yes"; then - cp "${source_dir}/shim.efi" "${efibootdir}/${def_boot_efi}" - if test "$removable" = "no"; then - cp "${source_dir}/fallback.efi" "${efibootdir}" - fi -fi - - -make_grubcfg () { - -grub_cfg_dirname=`dirname $grub_cfg` -grub_cfg_basename=`basename $grub_cfg` -cfg_fs_uuid=`"$grub_probe" --target=fs_uuid "$grub_cfg_dirname"` -# bsc#1153953 - Leap 42.3 boot error snapshot missing -# We have to check btrfs is used as root file system to enable relative path -# lookup for file to be on par with other utility which also accounts for it. -GRUB_FS="$(stat -f --printf=%T / || echo unknown)" - -if test "x$SUSE_BTRFS_SNAPSHOT_BOOTING" = "xtrue" && - [ "x${GRUB_FS}" = "xbtrfs" ] ; then -cat < "${efidir}/grub.cfg" -# bnc#889765 GRUB shows broken letters at boot -# invoke grub_install to initialize /boot/grub2 directory with files needed by grub.cfg -# bsc#1118363 shim-install didn't specify the target for grub2-install -# set the target explicitly for some special cases -${grub_install} --target=${grub_install_target} --no-nvram - -if test "$no_nvram" = no && test -n "$bootloader_id"; then - - modprobe -q efivars 2>/dev/null || true - - # Delete old entries from the same distributor. - for bootnum in `$efibootmgr | grep '^Boot[0-9]' | \ - fgrep -i " $bootloader_id" | cut -b5-8`; do - $efibootmgr -b "$bootnum" -B - done - - efidir_drive="$("$grub_probe" --target=drive --device-map= "$efidir")" - 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 - # 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";};') - if [ "$MD_LEVEL" != "raid1" ]; then - echo "GRUB drive for $efidir not on RAID1; unable to create EFI Boot Manager entry." >&2 - fi - for mddev in $MD_DEVS; do - efidir_drive="$("$grub_probe" --target=drive --device-map= -d "$mddev")" - efidir_disk="$("$grub_probe" --target=disk --device-map= -d "$mddev")" - efidir_part="$(echo "$efidir_drive" | sed 's/^([^,]*,[^0-9]*//; s/[^0-9].*//')" - efidir_d=${mddev#/dev/} - $efibootmgr -c -d "$efidir_disk" -p "$efidir_part" -w \ - -L "$bootloader_id ($efidir_d)" -l "\\EFI\\$efi_distributor\\$efi_file" - done - else - efidir_part="$(echo "$efidir_drive" | sed 's/^([^,]*,[^0-9]*//; s/[^0-9].*//')" - $efibootmgr -c -d "$efidir_disk" -p "$efidir_part" -w \ - -L "$bootloader_id" -l "\\EFI\\$efi_distributor\\$efi_file" - fi -fi - diff --git a/shim-leap.changes b/shim-leap.changes index 5e643a6..7180fc3 100644 --- a/shim-leap.changes +++ b/shim-leap.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Aug 11 06:36:37 UTC 2020 - Gary Ching-Pang Lin + +- Update shim to 15+git47-lp152.4.3.1 from openSUSE Leap 15.2 + + Version: 15+git47 "Fri Jul 31 07:41:26 UTC 2020" + + Use shim-install in the rpm package + ------------------------------------------------------------------- Wed Jul 22 09:33:51 UTC 2020 - Gary Ching-Pang Lin diff --git a/shim-leap.spec b/shim-leap.spec index 2981f24..24b3575 100644 --- a/shim-leap.spec +++ b/shim-leap.spec @@ -25,13 +25,12 @@ %endif Name: shim-leap -Version: 14 +Version: 15+git47 Release: 0 Summary: UEFI shim loader License: BSD-2-Clause Group: System/Boot -Source: shim-14-lp150.8.5.1.x86_64.rpm -Source1: shim-install +Source: shim-15+git47-lp152.4.3.1.x86_64.rpm BuildRoot: %{_tmppath}/%{name}-%{version}-build ExclusiveArch: x86_64 @@ -55,14 +54,7 @@ rpm2cpio %{SOURCE0} | cpio --extract --unconditional --preserve-modification-tim %install # purely repackaged cp -a * %{buildroot} -install -m 755 %{SOURCE1} %{buildroot}/%{_sbindir} - -# Move 'efi'-executables to '/usr/share/efi' (FATE#326960, bsc#1166523) -install -d %{buildroot}/%{sysefidir} -mv %{buildroot}/usr/lib64/efi/* %{buildroot}/%{sysefidir} -%if %{defined shim_lib64_share_compat} -ln -srf %{buildroot}/%{sysefidir}/*.efi %{buildroot}/usr/lib64/efi/ -%endif +# NOTE: shim-15+git47 already contains the sym-link to /usr/lib64/efi. %post -n shim /sbin/update-bootloader --reinit || true