grubby-bls: use title field instead of version for zipl default entry

Most bootloaders use the BootLoaderSpec "title" field to name the entries
in their boot menu. The zipl bootloader used the "version" field instead,
since it was wrongly assumed that the zipl boot menu didn't support names
that contained spaces, which are usually present in a BLS "title" field.

But this is not the case, names with space characters are supported by the
IPL and is just a constraint of the section heading in the zipl.conf file.

To be consistent with all the other bootloaders, zipl now uses the "title"
field to populate the boot menu entries from BLS files. So change grubby
to use the "title" field to set the default entry of the "version" field.

Related: rhbz#1645200

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
Javier Martinez Canillas 2018-11-21 10:44:33 +01:00
parent 4925c9ded9
commit 791d55400b
No known key found for this signature in database
GPG Key ID: C751E590D63F3D69

View File

@ -129,7 +129,7 @@ get_default_index() {
if [[ $bootloader = "grub2" ]]; then
id="$default"
else
version="$default"
title="$default"
fi
for i in ${!bls_file[@]}; do
@ -143,7 +143,7 @@ get_default_index() {
return
fi
if [[ $bootloader = "zipl" && $version = ${bls_version[$i]} ]]; then
if [[ $bootloader = "zipl" && $title = ${bls_title[$i]} ]]; then
echo $i
return
fi
@ -459,7 +459,7 @@ set_default_bls() {
if [[ $bootloader = grub2 ]]; then
grub2-editenv "${env}" set saved_entry="${bls_id[$index]}"
else
local default="${bls_version[$index]}"
local default="${bls_title[$index]}"
local current="$(grep '^default=' ${zipl_config} | sed -e 's/^default=//')"
if [[ -n $current ]]; then
sed -i -e "s,^default=.*,default=${default}," "${zipl_config}"