From 38466a0c77e944e8de146edb5c874505bf81c3bd Mon Sep 17 00:00:00 2001 From: eabdullin Date: Tue, 17 Dec 2024 08:49:41 +0000 Subject: [PATCH] Import from CS git --- .gitignore | 2 +- SOURCES/20-grub.install | 3 ++- SOURCES/99-grub-mkconfig.install | 10 ++++++++-- SPECS/grub2.spec | 10 +++++++++- 4 files changed, 20 insertions(+), 5 deletions(-) mode change 100644 => 100755 SOURCES/99-grub-mkconfig.install diff --git a/.gitignore b/.gitignore index 02903bf..c48971f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,4 @@ SOURCES/redhatsecureboot701.cer SOURCES/redhatsecurebootca3.cer SOURCES/redhatsecurebootca5.cer SOURCES/theme.tar.bz2 -SOURCES/unifont-5.1.20080820.pcf.gz \ No newline at end of file +SOURCES/unifont-5.1.20080820.pcf.gz diff --git a/SOURCES/20-grub.install b/SOURCES/20-grub.install index 2bb65b8..0ecf1e2 100755 --- a/SOURCES/20-grub.install +++ b/SOURCES/20-grub.install @@ -155,8 +155,9 @@ case "$COMMAND" in if [[ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]] || [[ ! -f /sbin/new-kernel-pkg ]]; then ARCH="$(uname -m)" BLS_TARGET="${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" + BLS_FAKE_TARGET="${BLS_DIR}/ffffffffffffffffffffffffffffffff-${KERNEL_VERSION}.conf" BLS_DEBUG="$(echo ${BLS_TARGET} | sed -e "s/${KERNEL_VERSION}/${KERNEL_VERSION}~debug/")" - rm -f "${BLS_TARGET}" "${BLS_DEBUG}" + rm -f "${BLS_TARGET}" "${BLS_DEBUG}" "${BLS_FAKE_TARGET}" for i in vmlinuz System.map config zImage.stub dtb; do rm -rf "/boot/${i}-${KERNEL_VERSION}" diff --git a/SOURCES/99-grub-mkconfig.install b/SOURCES/99-grub-mkconfig.install old mode 100644 new mode 100755 index b14fc82..57e2cd2 --- a/SOURCES/99-grub-mkconfig.install +++ b/SOURCES/99-grub-mkconfig.install @@ -9,16 +9,22 @@ ARCH=$(uname -m) [[ -f /etc/default/grub ]] && . /etc/default/grub # Can't assume a BLS capable bootloader on ppc64 -if [[ x$GRUB_ENABLE_BLSCFG != xfalse && +if [[ x$GRUB_ENABLE_BLSCFG = xtrue && $ARCH != "ppc64" && $ARCH != "ppc64le" ]]; then exit 0 fi COMMAND="$1" +grub_cfg=/boot/grub2/grub.cfg +if mountpoint -q /boot/efi; then + os_name=$(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/' -e 's/\"//g') + grub_cfg=/boot/efi/EFI/$os_name/grub.cfg +fi + case "$COMMAND" in add|remove) - grub2-mkconfig --no-grubenv-update -o /boot/grub2/grub.cfg >& /dev/null + grub2-mkconfig --no-grubenv-update -o $grub_cfg >& /dev/null ;; *) ;; diff --git a/SPECS/grub2.spec b/SPECS/grub2.spec index fbad142..60a1e2b 100644 --- a/SPECS/grub2.spec +++ b/SPECS/grub2.spec @@ -7,7 +7,7 @@ Name: grub2 Epoch: 1 Version: 2.02 -Release: 158%{?dist} +Release: 160%{?dist} Summary: Bootloader with support for Linux, Multiboot and more Group: System Environment/Base License: GPLv3+ @@ -523,6 +523,14 @@ fi %endif %changelog +* Wed Nov 13 2024 Leo Sandoval - 2.02-160 +- Remove BLS fake config in case of kernel removal +- Resolves: #RHEL-4316 + +* Tue Nov 12 2024 Leo Sandoval - 2.02-159 +- Fix default behavior when GRUB_ENABLE_BLSCFG is not present +- Resolves: #RHEL-4319 + * Thu Sep 19 2024 Leo Sandoval - 2.02-158 - grub-mkconfig.in: turn off executable owner bit - Resolves: #RHEL-58835