mirror of
https://github.com/linuxboot/heads.git
synced 2025-04-07 19:34:26 +00:00
Merge pull request #784 from MrChromebox/default_boot_fixes
Fix OEM factory reset and setting of default boot with F32
This commit is contained in:
commit
3c551cc249
@ -173,7 +173,7 @@ scan_options() {
|
||||
kexec-parse-bls "$bootdir" "$i" "$bootdir/loader/entries" >> $option_file
|
||||
done
|
||||
fi
|
||||
if [ ! -r $option_file ]; then
|
||||
if [ ! -s $option_file ]; then
|
||||
die "Failed to parse any boot options"
|
||||
fi
|
||||
if [ "$unique" = 'y' ]; then
|
||||
|
@ -201,7 +201,15 @@ set_default_boot_option()
|
||||
for i in `find /boot -name "grub.cfg"`; do
|
||||
kexec-parse-boot "/boot" "$i" >> $option_file
|
||||
done
|
||||
[ ! -r $option_file ] \
|
||||
# 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
|
||||
[ ! -s $option_file ] \
|
||||
&& whiptail_error_die "Failed to parse any boot options"
|
||||
|
||||
# sort boot options
|
||||
@ -213,8 +221,11 @@ set_default_boot_option()
|
||||
# clear existing default configs
|
||||
rm "/boot/kexec_default.*.txt" 2>/dev/null
|
||||
|
||||
# get correct index for entry
|
||||
index=$(grep -n "$entry" $option_file | cut -f1 -d ':')
|
||||
|
||||
# write new config
|
||||
echo "$entry" > /boot/kexec_default.1.txt
|
||||
echo "$entry" > /boot/kexec_default.$index.txt
|
||||
|
||||
# validate boot option
|
||||
( cd /boot && /bin/kexec-boot -b "/boot" -e "$entry" -f \
|
||||
|
Loading…
x
Reference in New Issue
Block a user