1.0.23 release

pull/500/head v1.0.23
longpanda 4 years ago
parent 0217c5a923
commit c0d478c2dd

@ -969,19 +969,28 @@ static struct grub_menu_execute_callback execution_callback =
static grub_err_t
show_menu (grub_menu_t menu, int nested, int autobooted)
{
const char *def;
def = grub_env_get("VTOY_DEFAULT_IMAGE");
while (1)
{
int boot_entry;
grub_menu_entry_t e;
int auto_boot;
boot_entry = run_menu (menu, nested, &auto_boot);
if (boot_entry < 0)
break;
g_ventoy_last_entry = boot_entry;
if (g_ventoy_menu_esc)
break;
if (auto_boot && def && grub_strcmp(def, "VTOY_EXIT") == 0) {
grub_exit();
}
if (autobooted == 0 && auto_boot == 0) {
g_ventoy_last_entry = boot_entry;
if (g_ventoy_menu_esc)
break;
}
e = grub_menu_get_entry (menu, boot_entry);
if (! e)

@ -57,6 +57,7 @@ int g_valid_initrd_count = 0;
int g_default_menu_mode = 0;
int g_filt_dot_underscore_file = 0;
int g_sort_case_sensitive = 0;
int g_tree_view_menu_style = 0;
static grub_file_t g_old_file;
static int g_ventoy_last_entry_back;
@ -991,7 +992,7 @@ static grub_err_t ventoy_cmd_check_compatible(grub_extcmd_context_t ctxt, int ar
grub_disk_close(disk);
g_img_swap_tmp_buf[703] = 0;
for (i = 319; i < 703; i++)
for (i = 318; i < 703; i++)
{
if (g_img_swap_tmp_buf[i] == 'V' &&
0 == grub_strncmp(g_img_swap_tmp_buf + i, VENTOY_COMPATIBLE_STR, VENTOY_COMPATIBLE_STR_LEN))
@ -1471,10 +1472,20 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node)
{
if (g_default_menu_mode == 0)
{
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"menuentry \"%-10s [Return to ListView]\" --class=\"vtoyret\" VTOY_RET {\n "
" echo 'return ...' \n"
"}\n", "<--");
if (g_tree_view_menu_style == 0)
{
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"menuentry \"%-10s [Return to ListView]\" --class=\"vtoyret\" VTOY_RET {\n "
" echo 'return ...' \n"
"}\n", "<--");
}
else
{
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"menuentry \"[Return to ListView]\" --class=\"vtoyret\" VTOY_RET {\n "
" echo '%s ...' \n"
"}\n", "return");
}
}
}
else
@ -1488,22 +1499,52 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node)
dir_alias = ventoy_plugin_get_menu_alias(vtoy_alias_directory, node->dir);
if (dir_alias)
{
if (g_tree_view_menu_style == 0)
{
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"submenu \"%-10s %s\" --class=\"%s\" --id=\"DIR_%s\" {\n",
"DIR", dir_alias, dir_class, node->dir + offset);
}
else
{
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"submenu \"%s\" --class=\"%s\" --id=\"DIR_%s\" {\n",
dir_alias, dir_class, node->dir + offset);
}
}
else
{
dir_alias = node->dir + offset;
if (g_tree_view_menu_style == 0)
{
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"submenu \"%-10s [%s]\" --class=\"%s\" --id=\"DIR_%s\" {\n",
"DIR", dir_alias, dir_class, node->dir + offset);
}
else
{
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"submenu \"[%s]\" --class=\"%s\" --id=\"DIR_%s\" {\n",
dir_alias, dir_class, node->dir + offset);
}
}
if (g_tree_view_menu_style == 0)
{
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"submenu \"%-10s %s\" --class=\"%s\" {\n",
"DIR", dir_alias, dir_class);
"menuentry \"%-10s [../]\" --class=\"vtoyret\" VTOY_RET {\n "
" echo 'return ...' \n"
"}\n", "<--");
}
else
{
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"submenu \"%-10s [%s]\" --class=\"%s\" {\n",
"DIR", node->dir + offset, dir_class);
"menuentry \"[../]\" --class=\"vtoyret\" VTOY_RET {\n "
" echo '%s ...' \n"
"}\n", "return");
}
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"menuentry \"%-10s [../]\" --class=\"vtoyret\" VTOY_RET {\n "
" echo 'return ...' \n"
"}\n", "<--");
}
while ((child = ventoy_get_min_child(node)) != NULL)
@ -1513,15 +1554,29 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node)
while ((img = ventoy_get_min_iso(node)) != NULL)
{
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"menuentry \"%-10s %s%s\" --class=\"%s\" --id=\"VID_%d\" {\n"
" %s_%s \n"
"}\n",
grub_get_human_size(img->size, GRUB_HUMAN_SIZE_SHORT),
img->unsupport ? "[***********] " : "",
img->alias ? img->alias : img->name, img->class, img->id,
img->menu_prefix,
img->unsupport ? "unsupport_menuentry" : "common_menuentry");
if (g_tree_view_menu_style == 0)
{
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"menuentry \"%-10s %s%s\" --class=\"%s\" --id=\"VID_%d\" {\n"
" %s_%s \n"
"}\n",
grub_get_human_size(img->size, GRUB_HUMAN_SIZE_SHORT),
img->unsupport ? "[***********] " : "",
img->alias ? img->alias : img->name, img->class, img->id,
img->menu_prefix,
img->unsupport ? "unsupport_menuentry" : "common_menuentry");
}
else
{
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos,
"menuentry \"%s%s\" --class=\"%s\" --id=\"VID_%d\" {\n"
" %s_%s \n"
"}\n",
img->unsupport ? "[***********] " : "",
img->alias ? img->alias : img->name, img->class, img->id,
img->menu_prefix,
img->unsupport ? "unsupport_menuentry" : "common_menuentry");
}
}
if (node != &g_img_iterator_head)
@ -1634,6 +1689,65 @@ int ventoy_check_device(grub_device_t dev)
return ventoy_check_device_result(0);
}
static int ventoy_set_default_menu(void)
{
int img_len = 0;
char *pos = NULL;
char *end = NULL;
char *def = NULL;
img_info *cur = NULL;
img_info *default_node = NULL;
const char *default_image = NULL;
default_image = ventoy_get_env("VTOY_DEFAULT_IMAGE");
if (default_image && default_image[0] == '/')
{
img_len = grub_strlen(default_image);
for (cur = g_ventoy_img_list; cur; cur = cur->next)
{
if (img_len == cur->pathlen && grub_strcmp(default_image, cur->path) == 0)
{
default_node = cur;
break;
}
}
if (!default_node)
{
return 1;
}
if (0 == g_default_menu_mode)
{
vtoy_ssprintf(g_list_script_buf, g_list_script_pos, "set default='VID_%d'\n", default_node->id);
}
else
{
def = grub_strdup(default_image);
if (!def)
{
return 1;
}
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, "set default=%c", '\'');
pos = def + 1;
while ((end = grub_strchr(pos, '/')) != NULL)
{
*end = 0;
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, "DIR_%s>", pos);
pos = end + 1;
}
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, "VID_%d'\n", default_node->id);
grub_free(def);
}
}
return 0;
}
static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char **args)
{
int len;
@ -1641,11 +1755,8 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char
grub_device_t dev = NULL;
img_info *cur = NULL;
img_info *tail = NULL;
img_info *default_node = NULL;
const char *strdata = NULL;
char *device_name = NULL;
const char *default_image = NULL;
int img_len = 0;
char buf[32];
img_iterator_node *node = NULL;
img_iterator_node *tmp = NULL;
@ -1734,6 +1845,14 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char
fs->fs_dir(dev, node->dir, ventoy_colect_img_files, node);
}
strdata = ventoy_get_env("VTOY_TREE_VIEW_MENU_STYLE");
if (strdata && strdata[0] == '1' && strdata[1] == 0)
{
g_tree_view_menu_style = 1;
}
ventoy_set_default_menu();
for (node = &g_img_iterator_head; node; node = node->next)
{
ventoy_dynamic_tree_menu(node);
@ -1768,15 +1887,6 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char
"}\n", "<--");
}
default_image = ventoy_get_env("VTOY_DEFAULT_IMAGE");
if (g_default_menu_mode == 0)
{
if (default_image)
{
img_len = grub_strlen(default_image);
}
}
for (cur = g_ventoy_img_list; cur; cur = cur->next)
{
vtoy_ssprintf(g_list_script_buf, g_list_script_pos,
@ -1787,21 +1897,9 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char
cur->alias ? cur->alias : cur->name, cur->class, cur->id,
cur->menu_prefix,
cur->unsupport ? "unsupport_menuentry" : "common_menuentry");
if (g_default_menu_mode == 0 && default_image && default_node == NULL)
{
if (img_len == cur->pathlen && grub_strcmp(default_image, cur->path) == 0)
{
default_node = cur;
}
}
}
if (default_node)
{
vtoy_ssprintf(g_list_script_buf, g_list_script_pos, "set default='VID_%d'\n", default_node->id);
}
g_tree_script_buf[g_tree_script_pos] = 0;
g_list_script_buf[g_list_script_pos] = 0;
grub_snprintf(buf, sizeof(buf), "%d", g_ventoy_img_count);

@ -68,7 +68,15 @@ static int ventoy_plugin_control_check(VTOY_JSON *json, const char *isodisk)
pChild = pNode->pstChild;
if (pChild->enDataType == JSON_TYPE_STRING)
{
grub_printf("%s: %s\n", pChild->pcName, pChild->unData.pcStrVal);
if (grub_strcmp(pChild->pcName, "VTOY_DEFAULT_IMAGE") == 0)
{
grub_printf("%s: %s [%s]\n", pChild->pcName, pChild->unData.pcStrVal,
ventoy_check_file_exist("%s%s", isodisk, pChild->unData.pcStrVal) ? "OK" : "NOT EXIST");
}
else
{
grub_printf("%s: %s\n", pChild->pcName, pChild->unData.pcStrVal);
}
}
else
{

@ -42,6 +42,7 @@ if ! [ -e $VTOY_DM_PATH ]; then
blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1 \2/')
mknod -m 0666 $VTOY_DM_PATH b $blkdev_num
fi
cp -a $VTOY_DM_PATH /dev/ventoy
PATH=$VTPATH_OLD

@ -19,4 +19,4 @@
$SED '1 apmedia=usbhd' -i /init
$SED "/^ *HAVE_PARTS=/a\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/puppy-disk.sh" -i /init
$SED "/^ *HAVE_PARTS=/a\ HAVE_PARTS='mapper/ventoy|iso9660'" -i /init
$SED "/^ *HAVE_PARTS=/a\ HAVE_PARTS='ventoy|iso9660'" -i /init

Binary file not shown.

@ -1,5 +1,11 @@
#!/bin/sh
if ! [ -f ./tool/ventoy_lib.sh ]; then
if [ -f ${0%Ventoy2Disk.sh}/tool/ventoy_lib.sh ]; then
cd ${0%Ventoy2Disk.sh}
fi
fi
if [ -f ./ventoy/version ]; then
curver=$(cat ./ventoy/version)
fi
@ -12,13 +18,8 @@ echo " https://www.ventoy.net"
echo '**********************************************'
echo ''
OLDDIR=$PWD
if ! [ -f ./tool/xzcat ]; then
if [ -f ${0%Ventoy2Disk.sh}/tool/xzcat ]; then
cd ${0%Ventoy2Disk.sh}
fi
fi
OLDDIR=$(pwd)
PATH=./tool:$PATH
if ! [ -f ./boot/boot.img ]; then
if [ -d ./grub ]; then
@ -30,27 +31,30 @@ if ! [ -f ./boot/boot.img ]; then
fi
echo "############# Ventoy2Disk $* ################" >> ./log.txt
date >> ./log.txt
#decompress tool
if ! [ -f ./tool/ash ]; then
if [ -f ./tool/VentoyWorker.sh ]; then
echo "no need to decompress tools" >> ./log.txt
else
cd tool
chmod +x ./xzcat
if [ -f ./xzcat ]; then
chmod +x ./xzcat
fi
for file in $(ls *.xz); do
./xzcat $file > ${file%.xz}
xzcat $file > ${file%.xz}
chmod +x ${file%.xz}
done
cd ../
if ! [ -f ./tool/ash ]; then
echo 'Failed to decompress tools ...'
if [ -n "$OLDDIR" ]; then
cd $OLDDIR
fi
exit 1
fi
fi
./tool/ash ./tool/VentoyWorker.sh $*
if [ -f /bin/bash ]; then
bash ./tool/VentoyWorker.sh $*
else
./tool/ash ./tool/VentoyWorker.sh $*
fi
if [ -n "$OLDDIR" ]; then
cd $OLDDIR

@ -44,6 +44,12 @@ function ventoy_gui_console {
fi
}
function ventoy_acpi_param {
if [ "$VTOY_PARAM_NO_ACPI" != "1" ]; then
vt_acpi_param $1 $2
fi
}
function ventoy_power {
configfile $prefix/power.cfg
}
@ -436,6 +442,7 @@ function uefi_windows_menu_func {
ventoy_debug_pause
if [ -n "$vtoy_chain_mem_addr" ]; then
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
ventoy_cli_console
chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot
@ -540,6 +547,7 @@ function uefi_linux_menu_func {
vt_linux_chain_data ${1}${chosen_path}
if [ -n "$vtoy_chain_mem_addr" ]; then
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
ventoy_cli_console
chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} FirstTry=${FirstTryBootFile} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot
@ -553,6 +561,7 @@ function uefi_unix_menu_func {
ventoy_unix_comm_proc $1 ${chosen_path}
if [ -n "$vtoy_chain_mem_addr" ]; then
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
ventoy_cli_console
chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} FirstTry=${FirstTryBootFile} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot
@ -605,7 +614,7 @@ function uefi_iso_menu_func {
elif vt_check_mode 1; then
set ventoy_compatible=YES
else
vt_check_compatible (loop)
vt_check_compatible (loop)
fi
vt_img_sector ${1}${chosen_path}
@ -664,6 +673,7 @@ function legacy_windows_menu_func {
ventoy_debug_pause
if [ -n "$vtoy_chain_mem_addr" ]; then
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} ibft mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot
else
@ -728,6 +738,7 @@ function legacy_linux_menu_func {
ventoy_debug_pause
if [ -n "$vtoy_chain_mem_addr" ]; then
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot
else
@ -741,6 +752,7 @@ function legacy_unix_menu_func {
ventoy_unix_comm_proc $1 ${chosen_path}
if [ -n "$vtoy_chain_mem_addr" ]; then
#ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot
else
@ -1031,9 +1043,10 @@ function vtoyboot_common_func {
ventoy_debug_pause
if [ -n "$vtoy_chain_mem_addr" ]; then
if [ -n "$vtoy_chain_mem_addr" ]; then
ventoy_acpi_param ${vtoy_chain_mem_addr} 512
if [ "$grub_platform" = "pc" ]; then
vt_acpi_param ${vtoy_chain_mem_addr} 512
linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} sector512 mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot
else
@ -1303,6 +1316,7 @@ function img_common_menuentry {
fi
else
vt_linux_chain_data ${vtoy_iso_part}${vt_chosen_path}
ventoy_acpi_param ${vtoy_chain_mem_addr} 512
if [ "$grub_platform" = "pc" ]; then
linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} sector512 mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot
@ -1330,7 +1344,7 @@ function img_unsupport_menuentry {
#############################################################
#############################################################
set VENTOY_VERSION="1.0.22"
set VENTOY_VERSION="1.0.23"
# Default menu display mode, you can change it as you want.
# 0: List mode
@ -1426,7 +1440,7 @@ if [ -n "$vtoy_gfxmode" ]; then
set gfxmode=$vtoy_gfxmode
set gfxpayload=keep
else
set gfxmode=1920x1080,1366x768,1024x768,800x600,auto
set gfxmode=1024x768
set gfxpayload=keep
fi
@ -1457,6 +1471,7 @@ fi
#export necessary variable
export theme
export gfxmode
export gfxpayload
export vtoydev
export vtoy_path
export vtdebug_flag

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save