From ff9dc1ed7dc5997fe9ed8f5ec5fb02791448cd93 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 25 Oct 2018 10:54:24 +0200 Subject: [PATCH] Don't unconditionally set default entry when installing debug kernels If a debug kernel package is installed, the default entry should only be set when DEFAULTDEBUG=yes is set in /etc/sysconfig/kernel. Resolves: rhbz#1636346 Signed-off-by: Javier Martinez Canillas --- 20-grub.install | 15 ++++++++++++--- grub2.spec | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/20-grub.install b/20-grub.install index 8f74530..3f6e33f 100755 --- a/20-grub.install +++ b/20-grub.install @@ -98,7 +98,14 @@ case "$COMMAND" in sed -i -e "s,^initrd.*,initrd ${BOOTPREFIX}${INITRD},g" "${BLS_TARGET}" fi - NEWDEFAULT="${BLS_ID}" + if [[ "$KERNEL_VERSION" == *\+* ]] && [ "x$GRUB_DEFAULT_TO_DEBUG" != "xtrue" ]; then + GRUB_UPDATE_DEFAULT_KERNEL=false + fi + + if [ "x$GRUB_UPDATE_DEFAULT_KERNEL" = "xtrue" ]; then + NEWDEFAULT="${BLS_ID}" + fi + if [ "x$GRUB_LINUX_MAKE_DEBUG" = "xtrue" ]; then ARCH="$(uname -m)" BLS_DEBUG_ID="$(echo ${BLS_ID} | sed -e "s/${KERNEL_VERSION}/${KERNEL_VERSION}~debug/")" @@ -108,11 +115,13 @@ case "$COMMAND" in sed -i -e "s/^title.*/title ${TITLE}${GRUB_LINUX_DEBUG_TITLE_POSTFIX}/" "${BLS_DEBUG}" sed -i -e "s/^id.*/id ${BLS_DEBUG_ID}/" "${BLS_DEBUG}" sed -i -e "s/^options.*/options \$kernelopts ${GRUB_CMDLINE_LINUX_DEBUG}/" "${BLS_DEBUG}" - if [ "x$GRUB_UPDATE_DEFAULT_KERNEL" = "xtrue" -a "x$GRUB_DEFAULT_TO_DEBUG" = "xtrue" ]; then + if [ -n "$NEWDEFAULT" -a "x$GRUB_DEFAULT_TO_DEBUG" = "xtrue" ]; then NEWDEFAULT="${BLS_DEBUG_ID}" fi fi - grub2-editenv - set "saved_entry=${NEWDEFAULT}" + if [ -n "$NEWDEFAULT" ]; then + grub2-editenv - set "saved_entry=${NEWDEFAULT}" + fi # this probably isn't the best place to do this, but it will do for now. if [ -e "${BOOTPREFIX}${INITRD}" -a -e "${BOOTPREFIX}${LINUX}" -a \ diff --git a/grub2.spec b/grub2.spec index fed34e5..e9a954b 100644 --- a/grub2.spec +++ b/grub2.spec @@ -520,6 +520,8 @@ fi Resolves: rhbz#1636466 - Fix menu entry selection based on ID and title (pjones) Resolves: rhbz#1640979 +- Don't unconditionally set default entry when installing debug kernels + Resolves: rhbz#1636346 * Thu Oct 04 2018 Peter Jones - 2.02-62 - Exclude /etc/grub.d/01_fallback_counting until we work through some design