From 8cbbd4bb609acb2965f905b7d88294095cb6eb68afb6ca0125199783ca80ef90 Mon Sep 17 00:00:00 2001 From: Gary Ching-Pang Lin Date: Thu, 23 Jul 2020 08:40:18 +0000 Subject: [PATCH] Accepting request 822329 from home:gary_lin:branches:devel:openSUSE:Factory - Update the path to grub-tpm.efi in shim-install (bsc#1174320) - shim-install: add check for btrfs is used as root file system to enable relative path lookup for file. (bsc#1153953) - Update shim-install to handle the partitioned MD devices (bsc#1119762, bsc#1119763) - Update grub2 path in shim-install OBS-URL: https://build.opensuse.org/request/show/822329 OBS-URL: https://build.opensuse.org/package/show/devel:openSUSE:Factory/shim-leap?expand=0&rev=23 --- shim-install | 37 +++++++++++++++++++++++++++++++------ shim-leap.changes | 10 ++++++++++ 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/shim-install b/shim-install index 524c292..212e5a8 100644 --- a/shim-install +++ b/shim-install @@ -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="${datadir}/efi/${arch}" efibootmgr="/usr/sbin/efibootmgr" grub_probe="/usr/sbin/grub2-probe" grub_mkrelpath="/usr/bin/grub2-mkrelpath" @@ -23,7 +25,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" @@ -35,6 +36,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" @@ -139,7 +146,17 @@ do no_nvram=yes ;; --suse-enable-tpm) - source_grub_efi="/usr/lib/grub2/${grub_install_target}/grub-tpm.efi" ;; + # 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 ;; @@ -288,8 +305,13 @@ 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"; then +if test "x$SUSE_BTRFS_SNAPSHOT_BOOTING" = "xtrue" && + [ "x${GRUB_FS}" = "xbtrfs" ] ; then cat <&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";};') diff --git a/shim-leap.changes b/shim-leap.changes index 1133e43..5e643a6 100644 --- a/shim-leap.changes +++ b/shim-leap.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Wed Jul 22 09:33:51 UTC 2020 - Gary Ching-Pang Lin + +- Update the path to grub-tpm.efi in shim-install (bsc#1174320) +- shim-install: add check for btrfs is used as root file system to enable + relative path lookup for file. (bsc#1153953) +- Update shim-install to handle the partitioned MD devices + (bsc#1119762, bsc#1119763) +- Update grub2 path in shim-install + ------------------------------------------------------------------- Tue Mar 31 08:38:56 UTC 2020 - Gary Ching-Pang Lin