#------------------------------------------------------------------ # file: /boot/grub/config/bootother.cfg # #------------------------------------------------------------------ function windows_efi { if [ "${grub_platform}" != "efi" ]; then return; fi insmod ntfs insmod chain insmod part_gpt unset found_one echo "" echo $"searching for Windows bootloader"" ..." for drive in 0 1 2 3 4 5 6 7 8 9; do for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do if ! test -d (hd${drive},${part}); then continue; fi if ! test -s (hd${drive},${part})/EFI/Microsoft/Boot/bootmgfw.efi ; then continue; fi if [ -z "$found_one" ]; then set found_one="y" menuentry " ===> "$"Windows Bootloader"" <===" {true} fi echo $"found Windows bootloader on drive"" (hd${drive},${part})" menuentry $"Windows bootloader on drive"" (hd${drive},${part})" "${drive}" "${part}"{ insmod ntfs insmod chain insmod part_gpt set root=(hd${2},${3}) chainloader /EFI/Microsoft/Boot/bootmgfw.efi } done done if [ -z "$found_one" ]; then menuentry --hotkey=Q --class=found.none $"No Windows bootloader found." {main_menu} else echo "... "$"finished" echo -n $"Press »Enter« to continue"" " read key unset key back_to_main_menu fi } function windows_bootmgr { if [ "${grub_platform}" != "pc" ]; then return; fi unset found_one insmod fat insmod ntfs insmod part_msdos echo "" echo $"searching for Windows bootloader"" ..." for drive in 0 1 2 3 4 5; do for part in 1 2 3 4 5 6; do device="hd${drive},${part}" if ! test -d ($device); then continue; fi if test -s ($device)/bootmgr; then loader="bootmgr" if ! test -s ($device)/Boot/BCD; then continue; fi elif test -s ($device)/ntldr; then loader="ntldr" else continue fi if [ -z "$found_one" ]; then set found_one="y" menuentry " ===> "$"Windows Bootloader"" <===" {true} fi set devnum=0 regexp -s devnum 'hd([0-9]+)' "$device" unset fs_type probe -s fs_type -f "($device)" #unset label #probe -s label -l ($device) #if [ -z "$label" ] ; then set label="[No Label]"; fi #regexp -s found '^(.........)' "(${device}) " #echo $"found Windows bootloader on" " ${found}: ${label}" echo $"found Windows bootloader on" " ($device)" menuentry --class=found.windows " "$"Windows bootloader on drive"" ($device)/${loader}" "${fs_type}" "${device}" "${devnum}" "${loader}" { if [ -n "${2}" ]; then insmod "${2}" fi insmod part_msdos insmod ntldr set root=($3) set devnumn="$4" set loader="$5" if [ "${loader}" = 'ntldr' -a x"$devnum" != x"0" ]; then drivemap hd0 $root fi ntldr ($3)/$loader } done done if [ -z "$found_one" ]; then menuentry --hotkey=Q --class=found.none $"No Windows bootloader found." {main_menu} else echo "... "$"finished" echo -n $"Press »Enter« to continue"" " read key unset key back_to_main_menu fi } function find_windows_bootloader { submenu " "$"Windows bootloader" --class=windows.boot --hotkey=W --id 'find_windows_bootloader' { windows_bootloader } } function windows_bootloader { set last_chosen="$chosen"; if [ "${grub_platform}" = "efi" ]; then windows_efi else #windows_bootmgr if [ "${grub_platform}" != "pc" ]; then return; fi unset found_one insmod fat insmod ntfs insmod part_msdos echo "" echo $"searching for Windows bootloader"" ..." for drive in 0 1 2 3 4 5; do for part in 1 2 3 4 5 6; do device="hd${drive},${part}" if ! test -d ($device); then continue; fi if test -s ($device)/bootmgr; then loader="bootmgr" if ! test -s ($device)/Boot/BCD; then continue; fi elif test -s ($device)/ntldr; then loader="ntldr" else continue fi if [ -z "$found_one" ]; then set found_one="y" menuentry " ===> "$"Windows Bootloader"" <===" {true} fi set devnum=0 regexp -s devnum 'hd([0-9]+)' "$device" unset fs_type probe -s fs_type -f "($device)" #unset label #probe -s label -l ($device) #if [ -z "$label" ] ; then set label="[No Label]"; fi #regexp -s found '^(.........)' "(${device}) " echo $"found Windows bootloader on" " (${device})" menuentry --class=found.windows " "$"Windows bootloader on drive"" ($device)/${loader}" "${fs_type}" "${device}" "${devnum}" "${loader}" { if [ -n "${2}" ]; then insmod "${2}" fi insmod part_msdos insmod ntldr set root=($3) set devnumn="$4" set loader="$5" if [ "${loader}" = 'ntldr' -a x"$devnum" != x"0" ]; then drivemap hd0 $root fi ntldr ($3)/$loader } done done if [ -z "$found_one" ]; then menuentry --hotkey=Q --class=found.none $"No Windows bootloader found." {main_menu} else echo "... "$"finished" echo -n $"Press »Enter« to continue"" " read key unset key back_to_main_menu fi fi }