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

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