kernel: modify spec file to set grub default boot

When a new kernel is installed, the grub default boot image is
not modified which can result in the rescue image being selected.
We force the default to item 0 which will be the new kernel.

The issue is that the grub boot default is only changed when a kernel
is removed.  The way the scriptlets work is to update the grub options
(and default) for the kernel being removed, then update the options
(but not the default) for the kernel being added.  This works fine if
you are installing a new kernel, booting to it, then removing the old
one, but that is not what we do.  I think the proper long term solution
might be to change kernel-install, but the expedient way to fix the
problem is to make sure posttrans updates the grub default.

Testing

The term kernel patch refers to a designer patch which includes the
kernel and rpm's with kernel dependencies.  Generate three such patches.
Install/remove them in various combinations rebooting after each
operation.

install A; remove A  (PASS)
install A; install B; remove B; remove A; install B  (PASS)
install AB; remove B; install C  (PASS)
install ABC; remove CB; install C  (PASS)

Closes-Bug: 1954945

Signed-off-by: Joe Slater <joe.slater@windriver.com>
Change-Id: I7a92f20cf43816e5ebe0c47f91d7597afa392dcf
This commit is contained in:
Joe Slater 2021-12-15 12:27:44 -05:00
parent bb6ec6697a
commit 98644316c6
3 changed files with 5 additions and 3 deletions

View File

@ -2682,6 +2682,7 @@ fi\
%endif\
%endif\
/bin/kernel-install add %{KVERREL}%{?1:+%{1}} /lib/modules/%{KVERREL}%{?1:+%{1}}/vmlinuz || exit $?\
/usr/sbin/grub2-set-default 0 || :\
%{nil}
#

View File

@ -2668,6 +2668,7 @@ then\
fi\
%endif\
/bin/kernel-install add %{KVERREL}%{?1:+%{1}} /lib/modules/%{KVERREL}%{?1:+%{1}}/vmlinuz || exit $?\
/usr/sbin/grub2-set-default 0 || :\
%{nil}
#

View File

@ -1,3 +1,3 @@
bashate >= 0.2
PyYAML >= 3.1.0
yamllint >= 0.5.2
bashate
PyYAML
yamllint