]> glassweightruler.freedombox.rocks Git - Ventoy.git/blobdiff - INSTALL/grub/grub.cfg
1. Fix the blank item in the last of Language select menu
[Ventoy.git] / INSTALL / grub / grub.cfg
index 08eb5d1d70f163cee75d9d069116b8fa73acdc5d..fe130668fffa8dfbb05ec6cee6b0b924812777d2 100644 (file)
@@ -126,7 +126,8 @@ function ventoy_load_menu_lang_file {
 
 function get_os_type {
     set vtoy_os=Linux
-    
+    export vtoy_os
+
     if vt_str_begin "$vt_volume_id" "DLC Boot"; then
         if [ -f (loop)/DLCBoot.exe ]; then
             set vtoy_os=Windows
@@ -906,11 +907,6 @@ function ventoy_reset_nojoliet {
 }
 
 function uefi_iso_menu_func {
-
-    if [ -d (loop)/ ]; then
-        loopback -d loop
-    fi
-
     if [ -n "$vtisouefi" ]; then
         set LoadIsoEfiDriver=on
         unset vtisouefi
@@ -924,21 +920,13 @@ function uefi_iso_menu_func {
     vt_select_auto_install "${chosen_path}"
     vt_select_persistence "${chosen_path}"
 
-    if vt_is_udf "${1}${chosen_path}"; then
-        set ventoy_fs_probe=udf
-    else
-        set ventoy_fs_probe=iso9660
-        ventoy_reset_nojoliet
-
+    if ! vt_is_udf "${1}${chosen_path}"; then
         # Lenovo EasyStartup need an addional sector for boundary check
         if vt_str_begin "$vt_volume_id" "EasyStartup"; then
             vt_skip_svd "${vtoy_iso_part}${vt_chosen_path}"
             vt_append_extra_sector 1
         fi
     fi
-
-    loopback loop "${1}${chosen_path}"
-    get_os_type (loop)
     
     if [ -d (loop)/EFI ]; then
         set vt_efi_dir=YES
@@ -957,15 +945,6 @@ function uefi_iso_menu_func {
         vt_check_compatible (loop)        
     fi
     
-    if vt_need_secondary_menu "$vt_chosen_name"; then
-        vt_show_secondary_menu "$vt_chosen_path" "$vtoy_os" $vt_chosen_size
-        if vt_check_mode 0 "$vt_chosen_name"; then
-            uefi_iso_memdisk $vtoy_iso_part  "$vt_chosen_path"
-            vt_secondary_recover_mode
-            return
-        fi
-    fi
-    
     vt_img_sector "${1}${chosen_path}"
     
     if [ "$ventoy_fs_probe" = "iso9660" ]; then
@@ -982,8 +961,7 @@ function uefi_iso_menu_func {
         uefi_linux_menu_func  "$1" "${chosen_path}"
     fi
 
-    ventoy_gui_console
-    vt_secondary_recover_mode
+    ventoy_gui_console    
 }
 
 function uefi_iso_memdisk {    
@@ -1368,26 +1346,10 @@ function legacy_unix_menu_func {
 
 
 function legacy_iso_menu_func {
-
-    if [ -d (loop)/ ]; then
-        loopback -d loop
-    fi
-
     set chosen_path="$2"
     
     vt_select_auto_install "${chosen_path}"
     vt_select_persistence "${chosen_path}"
-
-    if vt_is_udf "${1}${chosen_path}"; then
-        set ventoy_fs_probe=udf
-    else
-        set ventoy_fs_probe=iso9660
-        ventoy_reset_nojoliet
-    fi
-    
-    loopback loop "${1}${chosen_path}"
-    
-    get_os_type (loop)
     
     if [ -n "$vtcompat" ]; then
         set ventoy_compatible=YES
@@ -1398,15 +1360,6 @@ function legacy_iso_menu_func {
         vt_check_compatible (loop)
     fi
     
-    if vt_need_secondary_menu "$vt_chosen_name"; then
-        vt_show_secondary_menu "$vt_chosen_path" "$vtoy_os" $vt_chosen_size  
-        if vt_check_mode 0 "$vt_chosen_name"; then
-            legacy_iso_memdisk $vtoy_iso_part  "$vt_chosen_path"
-            vt_secondary_recover_mode
-            return
-        fi        
-    fi
-
     vt_img_sector "${1}${chosen_path}"
 
     if [ "$ventoy_fs_probe" = "iso9660" ]; then
@@ -1515,6 +1468,31 @@ function iso_common_menuentry {
     if ventoy_vcfg_proc "${vt_chosen_path}"; then        
         return
     fi
+    
+    
+    
+    #secondary boot menu
+    if vt_is_udf "${vtoy_iso_part}${vt_chosen_path}"; then
+        set ventoy_fs_probe=udf
+    else
+        set ventoy_fs_probe=iso9660
+        ventoy_reset_nojoliet
+    fi
+    
+    if [ -d (loop)/ ]; then
+        loopback -d loop
+    fi
+    loopback loop "${vtoy_iso_part}${vt_chosen_path}" 
+    
+    get_os_type (loop)
+    
+    if vt_need_secondary_menu "$vt_chosen_name"; then
+        vt_show_secondary_menu "$vt_chosen_path" "$vtoy_os" $vt_chosen_size
+        if [ "$VTOY_SECOND_EXIT" = "1" ]; then
+            return
+        fi
+    fi
+
 
     if vt_str_begin "$vt_volume_id" "Avira"; then 
         vt_skip_svd "${vtoy_iso_part}${vt_chosen_path}"
@@ -1566,7 +1544,9 @@ function iso_common_menuentry {
         else
             uefi_iso_menu_func $vtoy_iso_part  "$vt_chosen_path"
         fi
-    fi      
+    fi
+
+    vt_secondary_recover_mode
 }
 
 function miso_common_menuentry {