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
1 changed files with 3 additions and 3 deletions

View File

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