oem-factory-reset: Parse BLS format grub files

The same grub parsing logic used in kexec-select-boot should
be used here as well, so copy it over.

Test: oem-factory-reset succeeds with Fedora 32 installed.

Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
This commit is contained in:
Matt DeVillier 2020-07-28 22:24:32 -05:00
parent fbbdf67c57
commit 009c10465a
No known key found for this signature in database
GPG Key ID: 2BBB776A35B978FD

View File

@ -201,6 +201,14 @@ set_default_boot_option()
for i in `find /boot -name "grub.cfg"`; do
kexec-parse-boot "/boot" "$i" >> $option_file
done
# FC29/30+ may use BLS format grub config files
# https://fedoraproject.org/wiki/Changes/BootLoaderSpecByDefault
# only parse these if $option_file is still empty
if [ ! -s $option_file ] && [ -d "/boot/loader/entries" ]; then
for i in `find /boot -name "grub.cfg"`; do
kexec-parse-bls "/boot" "$i" "/boot/loader/entries" >> $option_file
done
fi
[ ! -r $option_file ] \
&& whiptail_error_die "Failed to parse any boot options"