insmod part_gpt
insmod fat
insmod chain
#insmod part_msdos
#insmod ext2
echo
echo "Scanning, first pass..."
list_env
echo "eins: '${1}' oder '$1'"
set
sleep 10
#for efi in (*,gpt*)/efi/*/grub.cfg (*,gpt*)/efi/*/*/grub.cfg (*,gpt*)/grub.cfg (*,gpt*)/*/grub.cfg (*,gpt*)/efi/grub/grubx64.efi (*,gpt*)/efi/boot/bootx64.efi (*,gpt*)/efi/*/*/bootmgfw.efi (*,gpt*)/efi/*/*.efi ; do
for efi in (*,gpt*)/efi/grub/grubx64.efi (*,gpt*)/efi/boot/bootx64.efi (*,gpt*)/efi/*/*/bootmgfw.efi (*,gpt*)/efi/*/*.efi \
(*,msdos*)/efi/grub/grubx64.efi (*,msdos*)/efi/boot/bootx64.efi (*,msdos*)/efi/*/*/bootmgfw.efi (*,msdos*)/efi/*/*.efi; do
regexp --set=1:efi_device '^\((.*)\)/' "${efi}"
done
echo "Scanning, second pass..."
for efi in (*,gpt*)/efi/grub/grubx64.efi (*,gpt*)/efi/boot/bootx64.efi (*,gpt*)/efi/*/*/bootmgfw.efi (*,gpt*)/efi/*/*.efi \
(*,msdos*)/efi/grub/grubx64.efi (*,msdos*)/efi/boot/bootx64.efi (*,msdos*)/efi/*/*/bootmgfw.efi (*,msdos*)/efi/*/*.efi; do
if [ -e "${efi}" ]; then
#regexp --set=1:efi_device '^\((.*)\)/' "${efi}"
regexp --set=1:root '^(\(.*\))/' "${efi}"
regexp --set=1:efi_path '^\(.*\)(/.*)$' "${efi}"
echo " >> Found operating system! <<"
echo " Path: '${efi}' on '${root}'"
echo " Fallback '${efi_path}'"
echo " Booting in 5s..."
sleep --interruptible --verbose 5
chainloader "${efi}"
boot
echo " That failed..."
fi
done
echo "No EFI known OS found. Reboot."
sleep --interruptible --verbose 15
reboot