grubby-bls: in s390* systems, run zipl on grub cfg update event

Change takes into account s390* systems as target for zipl
execution. Also, reformat better the rest of the archs/scenarios when
either zipl or grub2-mkconfig must be run.

Resolves: #RHEL-106612

Signed-off-by: Leo Sandoval <lsandova@redhat.com>
This commit is contained in:
Leo Sandoval 2025-09-03 13:18:53 -06:00
parent 15df64d0ea
commit e4db520c8c
2 changed files with 21 additions and 11 deletions

View File

@ -595,23 +595,29 @@ remove_var_prefix() {
update_grubcfg()
{
# Older ppc64le OPAL firmware don't have BLS support so grub2-mkconfig has to be run
# to generate a config with menuentry commands.
if [ "${arch}" = "ppc64le" ] && [ -d /sys/firmware/opal ]; then
# Turn on RUN_MKCONFIG on different archs/scenarios
if [[ "${arch}" = 's390' ]] || [[ "${arch}" = 's390x' ]]; then
# On s390/s390x systems, run mkconfig/zipl
RUN_MKCONFIG="true"
fi
# PV and PVH Xen DomU guests boot with pygrub that doesn't have BLS support,
# also Xen Dom0 use the menuentries from 20_linux_xen and not the ones from
# 10_linux. So grub2-mkconfig has to run for both Xen Dom0 and DomU.
if [[ -e /sys/hypervisor/type ]] && grep -q "^xen$" /sys/hypervisor/type; then
elif [[ "${arch}" = "ppc64le" ]] && [[ -d /sys/firmware/opal ]]; then
# Older ppc64le OPAL firmware don't have BLS support so grub2-mkconfig has to be run
# to generate a config with menuentry commands.
RUN_MKCONFIG="true"
elif [[ -e /sys/hypervisor/type ]] && grep -q "^xen$" /sys/hypervisor/type; then
if [ ! -e /sys/hypervisor/guest_type ] || ! grep -q "^HVM$" /sys/hypervisor/guest_type; then
# PV and PVH Xen DomU guests boot with pygrub that doesn't have BLS support,
# also Xen Dom0 use the menuentries from 20_linux_xen and not the ones from
# 10_linux. So grub2-mkconfig has to run for both Xen Dom0 and DomU.
RUN_MKCONFIG=true
fi
fi
if [[ $RUN_MKCONFIG = "true" ]]; then
grub2-mkconfig --no-grubenv-update -o "${grub_config}" >& /dev/null
if [[ $bootloader = "zipl" ]]; then
zipl
else
grub2-mkconfig --no-grubenv-update -o "${grub_config}" &> /dev/null
fi
fi
}

View File

@ -1,6 +1,6 @@
Name: grubby
Version: 8.40
Release: 68%{?dist}
Release: 69%{?dist}
Summary: Command line tool for updating bootloader configs
License: GPLv2+
URL: https://github.com/rhinstaller/grubby
@ -131,6 +131,10 @@ current boot environment.
%{_mandir}/man8/*.8*
%changelog
* Wed Sep 03 2025 Leo Sandoval <lsandova@redhat.com> - 8.40-69
- grubby-bls: in s390* systems, run zipl on grub cfg update event
Resolves: #RHEL-106612
* Wed Jul 30 2025 Leo Sandoval <lsandova@redhat.com> - 8.40-68
- Update cfg when setting a default kernel
Resolves: #RHEL-106612