mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-18 20:47:55 +00:00
kexec-select-boot: Extract boot menu scanning logic
Move boot menu scanning logic to scan_boot_options() in /etc/functions Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
This commit is contained in:
parent
3a917bb90b
commit
5d7afa2e02
@ -197,18 +197,7 @@ parse_option() {
|
||||
scan_options() {
|
||||
echo "+++ Scanning for unsigned boot options"
|
||||
option_file="/tmp/kexec_options.txt"
|
||||
if [ -r $option_file ]; then rm $option_file; fi
|
||||
for i in `find $bootdir -name "$config"`; do
|
||||
DO_WITH_DEBUG kexec-parse-boot "$bootdir" "$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 "$bootdir/loader/entries" ]; then
|
||||
for i in `find $bootdir -name "$config"`; do
|
||||
kexec-parse-bls "$bootdir" "$i" "$bootdir/loader/entries" >> $option_file
|
||||
done
|
||||
fi
|
||||
scan_boot_options "$bootdir" "$config" "$option_file"
|
||||
if [ ! -s $option_file ]; then
|
||||
die "Failed to parse any boot options"
|
||||
fi
|
||||
|
@ -523,6 +523,27 @@ detect_boot_device()
|
||||
return 1
|
||||
}
|
||||
|
||||
scan_boot_options()
|
||||
{
|
||||
local bootdir config option_file
|
||||
bootdir="$1"
|
||||
config="$2"
|
||||
option_file="$3"
|
||||
|
||||
if [ -r $option_file ]; then rm $option_file; fi
|
||||
for i in `find $bootdir -name "$config"`; do
|
||||
DO_WITH_DEBUG kexec-parse-boot "$bootdir" "$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 "$bootdir/loader/entries" ]; then
|
||||
for i in `find $bootdir -name "$config"`; do
|
||||
kexec-parse-bls "$bootdir" "$i" "$bootdir/loader/entries" >> $option_file
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
calc()
|
||||
{
|
||||
awk "BEGIN { print "$*" }";
|
||||
|
Loading…
Reference in New Issue
Block a user