This commit is contained in:
longpanda
2020-08-13 20:20:20 +08:00
parent 062f816020
commit 9962775296
33 changed files with 1016 additions and 39 deletions

View File

@@ -206,6 +206,11 @@ function distro_specify_initrd_file_phase2 {
if [ -f (loop)/parabola/boot/i686/parabolaiso.img ]; then
vt_linux_specify_initrd_file /parabola/boot/i686/parabolaiso.img
fi
elif [ -f (loop)/hyperbola/boot/x86_64/hyperiso.img ]; then
vt_linux_specify_initrd_file /hyperbola/boot/x86_64/hyperiso.img
if [ -f (loop)/hyperbola/boot/i686/hyperiso.img ]; then
vt_linux_specify_initrd_file /hyperbola/boot/i686/hyperiso.img
fi
elif [ -f (loop)/EFI/BOOT/initrd.img ]; then
#Qubes
vt_linux_specify_initrd_file /EFI/BOOT/initrd.img
@@ -230,6 +235,14 @@ function ventoy_get_ghostbsd_ver {
set vt_freebsd_ver=12.x
}
function ventoy_get_furybsd_ver {
if regexp "13\.[0-9]" "$2"; then
set vt_freebsd_ver=13.x
else
set vt_freebsd_ver=12.x
fi
}
function ventoy_get_freenas_ver {
set vt_freebsd_ver=11.x
@@ -250,6 +263,8 @@ function ventoy_freebsd_proc {
ventoy_get_ghostbsd_ver $1 ${chosen_path}
elif vt_strstr "$vt_volume_id" "FREENAS"; then
ventoy_get_freenas_ver $1 ${chosen_path}
elif vt_strstr "$vt_volume_id" "FURYBSD"; then
ventoy_get_furybsd_ver $1 ${chosen_path}
elif regexp "^13_[0-9]" "$vt_volume_id"; then
set vt_freebsd_ver=13.x
elif regexp "^12_[0-9]" "$vt_volume_id"; then
@@ -307,7 +322,7 @@ function ventoy_freebsd_proc {
fi
unset vt_unix_mod_path
for file in "/COPYRIGHT" "/FreeNAS-MANIFEST" "/version"; do
for file in "/COPYRIGHT" "/FreeNAS-MANIFEST" "/version" "/etc/fstab"; do
if [ -e (loop)${file} ]; then
set vt_unix_mod_path=${file}
break
@@ -442,6 +457,8 @@ function uefi_linux_menu_func {
elif [ -d (loop)/EFI/boot/entries ]; then
if [ -f (loop)/parabola/boot/x86_64/parabolaiso.img ]; then
vt_add_replace_file 0 "EFI\\parabolaiso\\parabolaiso.img"
elif [ -f (loop)/hyperbola/boot/x86_64/hyperiso.img ]; then
vt_add_replace_file 0 "EFI\\hyperiso\\hyperiso.img"
fi
elif [ -e (loop)/syslinux/alt0/full.cz ]; then
vt_add_replace_file 0 "EFI\\BOOT\\full.cz"
@@ -833,20 +850,125 @@ function efi_unsupport_menuentry {
common_unsupport_menuentry
}
#
#============================================================#
# IMG file boot process #
#============================================================#
#
function ventoy_img_busybox_ver {
set ventoy_busybox_ver=32
function ventoy_img_easyos {
vt_load_cpio $vtoy_path/ventoy.cpio ${vt_chosen_path} ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
vt_trailer_cpio ${vtoy_iso_part} ${vt_chosen_path} noinit
if [ -e (vtimghd,2)/etc/openwrt_release ]; then
if vt_file_strstr (vtimghd,2)/etc/openwrt_release x86_64; then
set ventoy_busybox_ver=64
fi
fi
loopback easysfs (vtimghd,1)/easy.sfs
vt_get_lib_module_ver (easysfs) /lib/modules/ vt_module_ver
if [ -n "$vt_module_ver" ]; then
for mod in "kernel/drivers/md/dm-mod.ko" "kernel/drivers/dax/dax.ko"; do
vt_img_extra_initrd_append (easysfs)/lib/modules/$vt_module_ver/$mod
done
fi
ventoy_debug_pause
#boot image file
vt_set_boot_opt rdinit=/vtoy/vtoy
vt_img_hook_root
syslinux_configfile (vtimghd,1)/syslinux.cfg
vt_img_unhook_root
vt_unset_boot_opt
loopback -d easysfs
}
function img_common_menuentry {
function ventoy_img_volumio {
vt_load_cpio $vtoy_path/ventoy.cpio ${vt_chosen_path} ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
vt_trailer_cpio ${vtoy_iso_part} ${vt_chosen_path} noinit
echo "To be implement"
ventoy_debug_pause
#boot image file
vt_set_boot_opt rdinit=/vtoy/vtoy imgpart=/dev/ventoy2 bootpart=/dev/ventoy1
vt_img_hook_root
syslinux_configfile (vtimghd,1)/syslinux.cfg
vt_img_unhook_root
vt_unset_boot_opt
}
function ventoy_img_fydeos {
set ventoy_busybox_ver=64
vt_load_cpio $vtoy_path/ventoy.cpio ${vt_chosen_path} ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
vt_trailer_cpio ${vtoy_iso_part} ${vt_chosen_path} noinit
# loopback easysfs (vtimghd,1)/easy.sfs
# vt_get_lib_module_ver (easysfs) /lib/modules/ vt_module_ver
# if [ -n "$vt_module_ver" ]; then
# for mod in "kernel/drivers/md/dm-mod.ko" "kernel/drivers/dax/dax.ko"; do
# vt_img_extra_initrd_append (easysfs)/lib/modules/$vt_module_ver/$mod
# done
# fi
ventoy_debug_pause
#boot image file
vt_set_boot_opt rdinit=/vtoy/vtoy
vt_img_hook_root
set root=(vtimghd,12)
configfile (vtimghd,12)/efi/boot/grub.cfg
#syslinux_configfile (vtimghd,12)/syslinux/syslinux.cfg
vt_img_unhook_root
vt_unset_boot_opt
}
function img_common_menuentry {
set ventoy_busybox_ver=32
vt_chosen_img_path vt_chosen_path vt_chosen_size
if [ -d (vtimghd)/ ]; then
loopback -d vtimghd
fi
loopback vtimghd ${vtoy_iso_part}${vt_chosen_path}
vt_img_sector ${vtoy_iso_part}${vt_chosen_path}
vt_img_part_info (vtimghd)
set vtback_root=$root
ventoy_cli_console
vt_push_last_entry
vt_img_extra_initrd_reset
if [ -e (vtimghd,1)/easy.sfs ]; then
ventoy_img_easyos
elif [ -e (vtimghd,1)/volumio.initrd ]; then
ventoy_img_volumio
elif [ -e (vtimghd,3)/etc/os-release ]; then
if vt_file_strstr (vtimghd,3)/etc/os-release FydeOS; then
ventoy_img_fydeos
fi
else
echo -e "\n This IMG file is NOT supported now. \n"
echo -e " 当前不支持启动此 IMG 文件 \n"
echo -e "\npress ENTER to exit (请按 回车 键返回) ..."
read vtInputKey
fi
set root=$vtback_root
vt_pop_last_entry
ventoy_gui_console
}
function img_unsupport_menuentry {