Blame SOURCES/0080-Print-default-image-even-if-isn-t-a-suitable-one.patch

af5b3d
From ee49b7b71d017097be5b4a0f32bff83379b0a86e Mon Sep 17 00:00:00 2001
af5b3d
From: Javier Martinez Canillas <javierm@redhat.com>
af5b3d
Date: Mon, 18 Mar 2019 12:53:23 +0100
af5b3d
Subject: [PATCH] Print default image even if isn't a suitable one
af5b3d
af5b3d
The grubby --default-kernel option only prints the default kernel if this
af5b3d
is a suitable one. That is if its associated kernel cmdline root param is
af5b3d
the same than the partition currently mounted as the filesystem root.
af5b3d
af5b3d
But the grubby --set-default option doesn't have that restriction, it is
af5b3d
able to set a kernel as the default even if its root is for a different
af5b3d
partition. So make the --default-kernel option to also print the kernel
af5b3d
in this case. Still check if is a suitable image so --debug can tell it.
af5b3d
af5b3d
Resolves: rhbz#1323842
af5b3d
af5b3d
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
af5b3d
---
af5b3d
 grubby.c                | 5 +++--
af5b3d
 test/results/debug/g2.1 | 1 +
af5b3d
 2 files changed, 4 insertions(+), 2 deletions(-)
af5b3d
af5b3d
diff --git a/grubby.c b/grubby.c
af5b3d
index 9c506aeb438..a7f823cb58c 100644
af5b3d
--- a/grubby.c
af5b3d
+++ b/grubby.c
af5b3d
@@ -5531,8 +5531,9 @@ int main(int argc, const char **argv)
af5b3d
 		entry = findEntryByIndex(config, config->defaultImage);
af5b3d
 		if (!entry)
af5b3d
 			return 0;
af5b3d
-		if (!suitableImage(entry, bootPrefix, 0, flags))
af5b3d
-			return 0;
af5b3d
+
af5b3d
+		/* check if is a suitable image but still print it */
af5b3d
+		suitableImage(entry, bootPrefix, 0, flags);
af5b3d
 
af5b3d
 		line =
af5b3d
 		    getLineByType(LT_KERNEL | LT_HYPER | LT_KERNEL_EFI |
af5b3d
diff --git a/test/results/debug/g2.1 b/test/results/debug/g2.1
af5b3d
index f5187f5f4b5..d579b59e59f 100644
af5b3d
--- a/test/results/debug/g2.1
af5b3d
+++ b/test/results/debug/g2.1
af5b3d
@@ -12,3 +12,4 @@ DBG: 	linux	/vmlinuz-2.6.38.8-32.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root
af5b3d
 DBG: 	echo	'Loading initial ramdisk ...'
af5b3d
 DBG: 	initrd	/initramfs-2.6.38.8-32.fc15.x86_64.img
af5b3d
 DBG: }
af5b3d
+/boot/vmlinuz-2.6.38.8-32.fc15.x86_64
af5b3d
-- 
af5b3d
2.20.1
af5b3d