util: Enable default kernel for updates

Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
This commit is contained in:
Nicolas Frayer 2023-08-22 14:14:44 +02:00
parent dc5c4e3f52
commit 5184f7bcf1
4 changed files with 44 additions and 2 deletions

View File

@ -0,0 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Marta Lewandowska <mlewando@redhat.com>
Date: Wed, 24 May 2023 11:22:47 +0200
Subject: [PATCH] util: Enable default kernel for updates
Several kernel variants can be installed on a system in parallel.
In order to allow the user to choose which kernel will be set to
default after an update, re-enable grub's usage of DEFAULTKERNEL as
set in /etc/sysconfig/kernel
Signed-off-by: Marta Lewandowska <mlewando@redhat.com>
---
util/grub-get-kernel-settings.in | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/util/grub-get-kernel-settings.in b/util/grub-get-kernel-settings.in
index 7e87dfccc0e4..f71bc64360b0 100644
--- a/util/grub-get-kernel-settings.in
+++ b/util/grub-get-kernel-settings.in
@@ -68,6 +68,14 @@ if test -f /etc/sysconfig/kernel ; then
. /etc/sysconfig/kernel
fi
+GRUB_DEFAULT_KERNEL_TYPE=${DEFAULTKERNEL/-core/}
+if [ "$GRUB_DEFAULT_KERNEL_TYPE" != "kernel" ]; then
+ echo GRUB_NON_STANDARD_KERNEL=true
+ echo export GRUB_NON_STANDARD_KERNEL
+ GRUB_DEFAULT_KERNEL_TYPE=${GRUB_DEFAULT_KERNEL_TYPE/kernel-/}
+fi
+echo GRUB_DEFAULT_KERNEL_TYPE=$GRUB_DEFAULT_KERNEL_TYPE
+echo export GRUB_DEFAULT_KERNEL_TYPE
if [ "$MAKEDEBUG" = "yes" ]; then
echo GRUB_LINUX_MAKE_DEBUG=true
echo export GRUB_LINUX_MAKE_DEBUG

View File

@ -139,7 +139,11 @@ case "$COMMAND" in
sed -i -e "s,^initrd.*,initrd ${BOOTPREFIX}${INITRD},g" "${BLS_TARGET}" sed -i -e "s,^initrd.*,initrd ${BOOTPREFIX}${INITRD},g" "${BLS_TARGET}"
fi fi
if [[ "$KERNEL_VERSION" == *\+debug* ]] && [ "x$GRUB_DEFAULT_TO_DEBUG" != "xtrue" ]; then if ( [[ "$KERNEL_VERSION" != *${GRUB_DEFAULT_KERNEL_TYPE}* ]] && \
[ "x$GRUB_NON_STANDARD_KERNEL" == "xtrue" ] ) || \
( echo "$KERNEL_VERSION" | grep -E -q "64k|auto|rt|uki" && \
[ "x$GRUB_NON_STANDARD_KERNEL" != "xtrue" ] ) || \
( [[ "$KERNEL_VERSION" == *debug* ]] && [ "x$GRUB_DEFAULT_TO_DEBUG" != "xtrue" ] ); then
GRUB_UPDATE_DEFAULT_KERNEL=false GRUB_UPDATE_DEFAULT_KERNEL=false
fi fi

View File

@ -330,3 +330,4 @@ Patch0329: 0329-grub_dl_set_mem_attrs-fix-format-string.patch
Patch0330: 0330-grub_dl_set_mem_attrs-add-self-check-for-the-tramp-G.patch Patch0330: 0330-grub_dl_set_mem_attrs-add-self-check-for-the-tramp-G.patch
Patch0331: 0331-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch Patch0331: 0331-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch
Patch0332: 0332-emu-Add-switch-root-to-grub-emu.patch Patch0332: 0332-emu-Add-switch-root-to-grub-emu.patch
Patch0333: 0333-util-Enable-default-kernel-for-updates.patch

View File

@ -17,7 +17,7 @@
Name: grub2 Name: grub2
Epoch: 1 Epoch: 1
Version: 2.06 Version: 2.06
Release: 95%{?dist} Release: 96%{?dist}
Summary: Bootloader with support for Linux, Multiboot and more Summary: Bootloader with support for Linux, Multiboot and more
License: GPLv3+ License: GPLv3+
URL: http://www.gnu.org/software/grub/ URL: http://www.gnu.org/software/grub/
@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg
%endif %endif
%changelog %changelog
* Tue Aug 22 2023 Nicolas Frayer <nfrayer@redhat.com> - 2.06-96
- util: Enable default kernel for updates
* Wed Apr 12 2023 Robbie Harwood <rharwood@redhat.com> - 2.06-95 * Wed Apr 12 2023 Robbie Harwood <rharwood@redhat.com> - 2.06-95
- Add switch-root support to grub-emu - Add switch-root support to grub-emu