]> glassweightruler.freedombox.rocks Git - Ventoy.git/blobdiff - INSTALL/grub/grub.cfg
1.0.36 release
[Ventoy.git] / INSTALL / grub / grub.cfg
index 03058f1d463246a09607d205848ea0401c0c531e..3f44dad5cd1488c691ed3294251327b42b21b5d3 100644 (file)
@@ -50,6 +50,21 @@ function ventoy_acpi_param {
     fi
 }
 
+function ventoy_vcfg_proc {
+    if vt_check_custom_boot "${1}" vt_vcfg; then
+        set vtoy_chosen_path="${1}"
+        vt_file_basefile "${vtoy_chosen_path}" vtoy_chosen_file
+        
+        export vtoy_chosen_path
+        export vtoy_chosen_file
+        ventoy_debug_pause
+        configfile "${vtoy_iso_part}${vt_vcfg}"
+        true
+    else
+        false
+    fi
+}
+
 function ventoy_power {
     configfile $prefix/power.cfg
 }
@@ -92,6 +107,9 @@ function get_os_type {
         elif [ -e (loop)/bin/freebsd-version ]; then
             set vtoy_os=Unix
             set vt_unix_type=FreeBSD
+        elif vt_str_begin "$vt_system_id" "DragonFly"; then
+            set vtoy_os=Unix
+            set vt_unix_type=DragonFly
             
             
         elif [ -e (loop)/boot/kernel/kernel ]; then            
@@ -284,7 +302,16 @@ function distro_specify_initrd_file_phase2 {
         if [ -f (loop)/EFI/BOOT/bootx64.efi ]; then
             vt_cpio_busybox64 "64h"
         fi
-        
+    elif [ -f (loop)/boot/initfs.x86_64-efi ]; then
+        vt_linux_specify_initrd_file /boot/initfs.x86_64-efi
+        if [ -f (loop)/boot/initfs.i386-pc ]; then
+            vt_linux_specify_initrd_file /boot/initfs.i386-pc
+        fi
+    elif [ -f (loop)/antiX/initrd.gz ]; then
+        vt_linux_specify_initrd_file /antiX/initrd.gz
+    elif [ -f (loop)/360Disk/initrd.gz ]; then
+        vt_linux_specify_initrd_file /360Disk/initrd.gz
+    
     fi
 }
 
@@ -426,6 +453,22 @@ function ventoy_freebsd_proc {
     vt_unix_replace_conf FreeBSD "${1}${chosen_path}"
 }
 
+function ventoy_dragonfly_proc {
+
+    unset vt_unix_mod_path
+    for file in "/boot/kernel/initrd.img.gz"; do
+        if [ -e (loop)${file} ]; then                    
+            set vt_unix_mod_path=${file}
+            break
+        fi
+    done
+
+    vt_unix_replace_ko $vt_unix_mod_path ${vtoy_path}/dragonfly.mfs.xz
+    vt_unix_fill_image_desc
+    vt_unix_gzip_new_ko
+    vt_unix_replace_conf DragonFly "${1}${chosen_path}"
+}
+
 function ventoy_unix_comm_proc {
     vt_unix_reset
     
@@ -434,11 +477,12 @@ function ventoy_unix_comm_proc {
         
         if [ "$vt_unix_type" = "FreeBSD" ]; then
             ventoy_freebsd_proc "$1" "${chosen_path}"
+        elif [ "$vt_unix_type" = "DragonFly" ]; then
+            ventoy_dragonfly_proc "$1" "${chosen_path}"        
         elif [ "$vt_unix_type" = "NetBSD" ]; then
             echo "NetBSD not supported"
             
             
-            
         else
             if [ -n "${vtdebug_flag}" ]; then
                 echo "Unknown unix type"
@@ -593,6 +637,12 @@ function uefi_linux_menu_func {
     
     vt_linux_chain_data "${1}${chosen_path}"
 
+    if [ -n "$LoadIsoEfiDriver" -a $vt_chosen_size -lt 104857600 ]; then
+        if [ -f (loop)/efi/clover/cloverx64.efi ]; then
+            unset LoadIsoEfiDriver
+        fi
+    fi
+
     if [ -n "$vtoy_chain_mem_addr" ]; then
         ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
         ventoy_cli_console       
@@ -618,6 +668,14 @@ function uefi_unix_menu_func {
     fi
 }
 
+function ventoy_reset_nojoliet {
+    if vt_str_begin "$vt_volume_id" "ARCARESCUE"; then
+        vt_iso9660_nojoliet 1
+    else
+        vt_iso9660_nojoliet 0
+    fi
+}
+
 function uefi_iso_menu_func {
 
     if [ -d (loop)/ ]; then
@@ -641,7 +699,7 @@ function uefi_iso_menu_func {
         set ventoy_fs_probe=udf
     else
         set ventoy_fs_probe=iso9660
-        vt_iso9660_nojoliet 0
+        ventoy_reset_nojoliet
     fi
 
     loopback loop "${1}${chosen_path}"
@@ -830,7 +888,7 @@ function legacy_iso_menu_func {
         set ventoy_fs_probe=udf
     else
         set ventoy_fs_probe=iso9660
-        vt_iso9660_nojoliet 0
+        ventoy_reset_nojoliet
     fi
     
     loopback loop "${1}${chosen_path}"
@@ -917,22 +975,41 @@ function ventoy_iso_busybox_ver {
             set ventoy_busybox_ver=64
         elif vt_str_begin "$vt_volume_id" "smgl-test-quinq-x86_64"; then
             set ventoy_busybox_ver=64
-            
+        elif vt_str_begin "$vt_volume_id" "LDiagBootable"; then
+            set ventoy_busybox_ver=64
+
         fi
     fi
 }
 
+
 function iso_common_menuentry {
     unset vt_system_id
     unset vt_volume_id
     
     vt_chosen_img_path vt_chosen_path vt_chosen_size
-    vt_parse_iso_volume "${vtoy_iso_part}${vt_chosen_path}" vt_system_id vt_volume_id
+
+    vt_parse_iso_volume "${vtoy_iso_part}${vt_chosen_path}" vt_system_id vt_volume_id vt_volume_space
+    if [ $vt_volume_space -ne $vt_chosen_size ]; then        
+        vt_mod $vt_chosen_size 2048 vt_chosen_size_mod
+        if [ $vt_volume_space -gt $vt_chosen_size -o $vt_chosen_size_mod -ne 0 ]; then
+            echo -e "\n $vt_volume_space $vt_chosen_size $vt_chosen_size_mod\n"
+            echo -e "\n The size of the iso file \"$vt_chosen_size\" is invalid. File corrupted ?\n"
+            echo -e " 此ISO文件的大小 \"$vt_chosen_size\" 有问题,请确认文件是否损坏。\n"
+            echo -e "\n press ENTER to exit (请按 回车 键返回) ..."
+            read vtInputKey
+            return
+        fi
+    fi
     
     if vt_check_password "${vt_chosen_path}"; then
         return
     fi
-        
+
+    if ventoy_vcfg_proc "${vt_chosen_path}"; then        
+        return
+    fi
+
     if vt_str_begin "$vt_volume_id" "Avira"; then 
         vt_skip_svd "${vtoy_iso_part}${vt_chosen_path}"
     fi
@@ -1002,6 +1079,10 @@ function wim_common_menuentry {
         return
     fi
     
+    if ventoy_vcfg_proc "${vt_chosen_path}"; then        
+        return
+    fi
+    
     if vt_wim_check_bootable "${vtoy_iso_part}${vt_chosen_path}"; then
         vt_wim_chain_data "${vtoy_iso_part}${vt_chosen_path}"
     else
@@ -1037,6 +1118,10 @@ function efi_common_menuentry {
         return
     fi
     
+    if ventoy_vcfg_proc "${vt_chosen_path}"; then        
+        return
+    fi
+    
     vt_concat_efi_iso "${vtoy_iso_part}${vt_chosen_path}" vtoy_iso_buf
     
     ventoy_debug_pause
@@ -1078,6 +1163,10 @@ function vhd_common_menuentry {
         return
     fi
     
+    if ventoy_vcfg_proc "${vt_chosen_path}"; then        
+        return
+    fi
+    
     vt_patch_vhdboot "$vt_chosen_path"
     
     ventoy_debug_pause    
@@ -1143,7 +1232,9 @@ function vtoyboot_common_func {
                 linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} bios80  sector512  mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}   
                 boot
             else
-                ventoy_acpi_param ${vtoy_chain_mem_addr} 512
+                if vt_check_secureboot_var; then
+                    vt_acpi_param ${vtoy_chain_mem_addr} 512
+                fi
                 ventoy_cli_console
                 chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi sector512 env_param=${ventoy_env_param} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
                 boot
@@ -1166,6 +1257,10 @@ function vtoy_common_menuentry {
         return
     fi    
     
+    if ventoy_vcfg_proc "${vt_chosen_path}"; then        
+        return
+    fi
+    
     vtoyboot_common_func "${vtoy_iso_part}${vt_chosen_path}"
 }
 
@@ -1369,6 +1464,10 @@ function img_common_menuentry {
         return
     fi
 
+    if ventoy_vcfg_proc "${vt_chosen_path}"; then        
+        return
+    fi
+
     if [ -d (vtimghd)/ ]; then
         loopback -d vtimghd
     fi
@@ -1447,7 +1546,7 @@ function img_unsupport_menuentry {
 #############################################################
 #############################################################
 
-set VENTOY_VERSION="1.0.30"
+set VENTOY_VERSION="1.0.36"
 
 #ACPI not compatible with Window7/8, so disable by default
 set VTOY_PARAM_NO_ACPI=1
@@ -1594,6 +1693,17 @@ if [ -n "$VTOY_PLUGIN_SYNTAX_ERROR" ]; then
     read vtInputKey 
 fi
 
+for vtTFile in ventoy.json ventoy_grub.cfg; do
+    if [ -f $vtoy_efi_part/ventoy/$vtTFile ]; then
+        clear
+        echo -e "\n You need to put $vtTFile in the 1st partition which hold the ISO files.\n"
+        echo -e " $vtTFile 放错分区了,请放到镜像分区里的 ventoy 目录下(此目录需要手动创建)!\n"
+        echo -e "\n press ENTER to continue (请按 回车 键继续) ..."
+        read vtInputKey
+    fi
+done
+
+
 #export necessary variable
 export theme
 export gfxmode