]> glassweightruler.freedombox.rocks Git - Ventoy.git/blobdiff - INSTALL/grub/localboot.cfg
1.0.27 release
[Ventoy.git] / INSTALL / grub / localboot.cfg
index 0afb344603cd3c2dc89b873aec4d8b37b94d6fe7..8400886527d9bbe6a70d9e6f0c8164ea2deca1ff 100644 (file)
@@ -1,9 +1,37 @@
 
 if [ "$grub_platform" = "pc" ]; then
-    menuentry 'Search and boot Windows' --class=boot_windows {    
-        if search -n -s -f /bootmgr; then
-            ntldr /bootmgr
-        elif search -n -s -f /ntldr; then
+    menuentry 'Search and boot Windows' --class=boot_windows {
+    
+        set partid=3
+        while [ $partid -le 128 ]; do
+            if vt_check_part_exist $partid; then
+                for bt in bootmgr BOOTMGR Bootmgr BootMGR; do
+                    if [ -f ($vtoydev,$partid)/$bt ]; then
+                        set root=($vtoydev,$partid)
+                        ntldr /$bt
+                        boot
+                    fi
+                done
+            else
+                break
+            fi
+            vt_incr partid 1
+        done
+    
+        if search -n -s -f /Boot/BCD; then
+            for bt in bootmgr BOOTMGR Bootmgr BootMGR; do
+                if [ -f /$bt ]; then
+                    if regexp '^hd0' $root; then
+                        ntldr /$bt
+                    else
+                        drivemap -s hd0 $root
+                        ntldr /$bt
+                    fi
+                    break
+                fi
+            done
+        elif search -n -s -f /NTDETECT.COM; then
+            drivemap -s hd0 $root
             ntldr /ntldr
         else
             echo "Windows NOT found ..."
@@ -39,6 +67,22 @@ if [ "$grub_platform" = "pc" ]; then
 else
 
     menuentry 'Search and boot Windows' --class=boot_windows {    
+        
+        set partid=3
+        while [ $partid -le 128 ]; do
+            if vt_check_part_exist $partid; then
+                if [ -f ($vtoydev,$partid)/EFI/Microsoft/Boot/bootmgfw.efi ]; then
+                    set root=($vtoydev,$partid)
+                    terminal_output  console
+                    chainloader /EFI/Microsoft/Boot/bootmgfw.efi
+                    boot
+                fi
+            else
+                break
+            fi
+            vt_incr partid 1
+        done
+                
         if search -n -s -f /EFI/Microsoft/Boot/bootmgfw.efi; then
             terminal_output  console
             chainloader /EFI/Microsoft/Boot/bootmgfw.efi
@@ -60,6 +104,6 @@ else
 
 fi
 
-menuentry 'Return to menu [Esc]' --class=vtoyret VTOY_RET {
+menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET {
     echo 'Return ...'
 }