Compare commits

..

33 Commits

Author SHA1 Message Date
longpanda
aa033e1fb6 1.0.54 release 2021-10-12 19:20:02 +08:00
longpanda
9351fe4f97 Fix a bug that menu_tip is not shown for the default menu item. 2021-10-12 16:02:25 +08:00
longpanda
67b8a34e8c Support WinPE with PESET.EXE 2021-10-12 11:24:04 +08:00
longpanda
c18399e8b4 Add support for 小鱼儿yr系统维护PE 2021-10-11 21:11:52 +08:00
longpanda
5a591c1ae7 Optimization for LiveCDGUI 2021-10-11 17:44:12 +08:00
longpanda
e208199cca Optimization for LiveCDGUI 2021-10-10 10:34:17 +08:00
longpanda
4c9065a60d Fix a bug when booting trisquel 10 (#1127) 2021-10-10 09:51:13 +08:00
longpanda
4fd4977c3a Fix a bug when install Untangle 2021-10-09 22:53:48 +08:00
longpanda
93614c3251 support Porteus v5.0rc3 2021-10-09 19:22:42 +08:00
longpanda
1db0827463 misc update 2021-09-30 13:54:44 +08:00
longpanda
72d0fd0dd4 Optimization for GUI LiveCD 2021-09-30 13:40:48 +08:00
longpanda
47797f0285 Optimization for GUI LiveCD 2021-09-30 07:37:49 +08:00
longpanda
849eb7bf2c chown root for LiveCD GUI 2021-09-29 22:20:49 +08:00
longpanda
32c5b5deea Add GUI LiveCD 2021-09-29 19:26:50 +08:00
longpanda
d72bb15956 1.0.53 release 2021-09-27 21:00:08 +08:00
longpanda
89a34bac18 optimization for deepin/uos latest release 2021-09-25 11:22:55 +08:00
longpanda
8cecdae8f9 Support shrink persistence dat file for ext4 filesystem. 2021-09-24 10:07:32 +08:00
longpanda
471432fc50 Optimization for VentoyGUI 2021-09-22 14:44:50 +08:00
Thomas De Rocker
a78e19608b Update languages.json (Dutch translations) (#1105) 2021-09-18 09:13:38 +08:00
Anton Grouchtchak
5e97d56033 Update Ukrainian and Russian translations (#1104) 2021-09-17 15:29:40 +08:00
albanobattistella
a5041ad43c Update languages.json (#1103) 2021-09-17 10:02:17 +08:00
3149a67599 Modify Japanese Localization (#1102)
* modify Japanese localization

- Corrected duplicate punctuation.
- Changed the font to one that is compatible with Japanese.
- Unified the terminology.
- Newly translated untranslated strings.

* modify Japanese localization

- Unified the terminology.
2021-09-17 10:01:43 +08:00
MELERIX
d0b7927b51 Update languages.json (#1088)
- Renamed "disk" to "device" for consistency, due not all devices are essentially disks.

- Minor changes in Spanish translation.
2021-09-17 09:58:36 +08:00
longpanda
8775684367 1.0.52 release 2021-09-13 18:48:09 +08:00
longpanda
d148139227 Add QT GUI install program 2021-09-13 16:41:51 +08:00
longpanda
dd2411d7d4 Add Linux native GUI program for Ventoy2Disk.
x86_64    gtk2/gtk3
i386      gtk2/gtk3
aarch64   gtk3
mips64el  gtk3
2021-09-08 10:44:41 +08:00
longpanda
7db83dc0f1 Update README.md 2021-08-31 19:50:35 +08:00
longpanda
787d950f28 Update README.md 2021-08-31 19:47:38 +08:00
longpanda
892a819da4 Add support for Emergency Boot Kit 2021-08-31 19:43:30 +08:00
longpanda
bfc5eaebb9 Continue to boot even the ISO file size is invalid. 2021-08-31 17:04:09 +08:00
longpanda
e7d05df9fa Update issue_template.yml 2021-08-31 16:47:40 +08:00
Oğuz Ersen
ca07b52cb2 Update languages.json (Turkish) (#1077) 2021-08-30 18:06:57 +08:00
longpanda
1a2a35f5bc add cryptsetup 2021-08-30 10:54:16 +08:00
308 changed files with 21287 additions and 412 deletions

View File

@@ -63,6 +63,13 @@ body:
placeholder: 32GB
validations:
required: true
- type: input
id: vendor
attributes:
label: Disk Manufacturer
description: What is the manufacturer of the disk installed with Ventoy? (e.g. SanDisk/Kingston...)
validations:
required: false
- type: dropdown
id: checksum
attributes:

View File

@@ -5,6 +5,6 @@ RUN yum -y -q install \
mpfr.i686 mpfr-devel.i686 rsync autogen autoconf automake libtool gettext* bison binutils \
flex device-mapper-devel SDL libpciaccess libusb freetype freetype-devel gnu-free-* qemu-* virt-* \
libvirt* vte* NetworkManager-bluetooth brlapi fuse-devel dejavu* gnu-efi* pesign shim \
iscsi-initiator-utils grub2-tools zip nasm acpica-tools glibc-static zlib-static xorriso
iscsi-initiator-utils grub2-tools zip nasm acpica-tools glibc-static zlib-static xorriso lz4 squashfs-tools
CMD cd /ventoy/INSTALL && ls -la && sh docker_ci_build.sh

File diff suppressed because it is too large Load Diff

View File

@@ -59,11 +59,15 @@ struct grub_gui_label
grub_font_t font;
grub_video_rgba_color_t color;
int value;
int vtoytip;
enum align_mode align;
};
typedef struct grub_gui_label *grub_gui_label_t;
extern const char * g_ventoy_tip_msg1;
extern const char * g_ventoy_tip_msg2;
static void
label_destroy (void *vself)
{
@@ -90,6 +94,7 @@ label_is_instance (void *vself __attribute__((unused)), const char *type)
static void
label_paint (void *vself, const grub_video_rect_t *region)
{
const char *text;
grub_gui_label_t self = vself;
if (! self->visible)
@@ -98,16 +103,24 @@ label_paint (void *vself, const grub_video_rect_t *region)
if (!grub_video_have_common_points (region, &self->bounds))
return;
if (self->vtoytip == 1) {
text = g_ventoy_tip_msg1 ? g_ventoy_tip_msg1 : "";
} else if (self->vtoytip == 2) {
text = g_ventoy_tip_msg2 ? g_ventoy_tip_msg2 : "";
} else {
text = self->text;
}
/* Calculate the starting x coordinate. */
int left_x;
if (self->align == align_left)
left_x = 0;
else if (self->align == align_center)
left_x = (self->bounds.width
- grub_font_get_string_width (self->font, self->text)) / 2;
- grub_font_get_string_width (self->font, text)) / 2;
else if (self->align == align_right)
left_x = (self->bounds.width
- grub_font_get_string_width (self->font, self->text));
- grub_font_get_string_width (self->font, text));
else
return; /* Invalid alignment. */
@@ -116,7 +129,7 @@ label_paint (void *vself, const grub_video_rect_t *region)
grub_video_rect_t vpsave;
grub_gui_set_viewport (&self->bounds, &vpsave);
grub_font_draw_string (self->text,
grub_font_draw_string (text,
self->font,
grub_video_map_rgba_color (self->color),
left_x,
@@ -156,8 +169,8 @@ static void
label_get_minimal_size (void *vself, unsigned *width, unsigned *height)
{
grub_gui_label_t self = vself;
*width = grub_font_get_string_width (self->font, self->text);
*height = (grub_font_get_ascent (self->font)
*width = grub_font_get_string_width (self->font, self->text);
*height = (grub_font_get_ascent (self->font)
+ grub_font_get_descent (self->font));
}
@@ -255,8 +268,14 @@ label_set_property (void *vself, const char *name, const char *value)
{
grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self);
grub_free (self->id);
if (value)
if (value) {
self->id = grub_strdup (value);
if (grub_strcmp(value, "VTOY_MENU_TIP_1") == 0) {
self->vtoytip = 1;
} else if (grub_strcmp(value, "VTOY_MENU_TIP_2") == 0) {
self->vtoytip = 2;
}
}
else
self->id = 0;
if (self->id && grub_strcmp (self->id, GRUB_GFXMENU_TIMEOUT_COMPONENT_ID)

View File

@@ -733,6 +733,8 @@ done:
return grub_errno;
}
extern int g_menu_update_mode;
/* Set properties on the view based on settings from the specified
theme file. */
grub_err_t
@@ -752,7 +754,7 @@ grub_gfxmenu_view_load_theme (grub_gfxmenu_view_t view, const char *theme_path)
}
p.len = grub_file_size (file);
p.buf = grub_malloc (p.len + 4096);
p.buf = grub_malloc (p.len + 8192);
p.pos = 0;
p.line_num = 1;
p.col_num = 1;
@@ -781,6 +783,33 @@ grub_gfxmenu_view_load_theme (grub_gfxmenu_view_t view, const char *theme_path)
}
}
{
const char *tip = grub_env_get("VTOY_MENU_TIP_ENABLE");
if (tip && tip[0] == '1')
{
char tmpmsg[512];
grub_memset(tmpmsg, 'w', 500);
tmpmsg[500] = 0;
g_menu_update_mode = 1;
p.len += grub_snprintf(p.buf + p.len, 4096,
"\n+ vbox{\n left = %s\n top = %s\n"
"+ label { id=\"VTOY_MENU_TIP_1\" text = \"%s\" color = \"%s\" align = \"%s\"}\n"
"+ label { id=\"VTOY_MENU_TIP_2\" text = \"%s\" color = \"%s\" align = \"%s\"}\n"
"}\n",
grub_env_get("VTOY_TIP_LEFT"),
grub_env_get("VTOY_TIP_TOP"),
tmpmsg,
grub_env_get("VTOY_TIP_COLOR"),
grub_env_get("VTOY_TIP_ALIGN"),
tmpmsg,
grub_env_get("VTOY_TIP_COLOR"),
grub_env_get("VTOY_TIP_ALIGN")
);
}
}
if (view->canvas)
view->canvas->component.ops->destroy (view->canvas);

View File

@@ -386,21 +386,37 @@ redraw_menu_visit (grub_gui_component_t component,
}
}
extern int g_menu_update_mode;
static void grub_gfxmenu_update_all(grub_gfxmenu_view_t view)
{
grub_video_set_area_status(GRUB_VIDEO_AREA_DISABLED);
grub_gfxmenu_view_redraw(view, &view->screen);
}
void
grub_gfxmenu_redraw_menu (grub_gfxmenu_view_t view)
{
update_menu_components (view);
grub_gui_iterate_recursively ((grub_gui_component_t) view->canvas,
redraw_menu_visit, view);
if (g_menu_update_mode)
grub_gfxmenu_update_all(view);
else
grub_gui_iterate_recursively ((grub_gui_component_t) view->canvas,
redraw_menu_visit, view);
grub_video_swap_buffers ();
if (view->double_repaint)
{
grub_gui_iterate_recursively ((grub_gui_component_t) view->canvas,
redraw_menu_visit, view);
if (g_menu_update_mode)
grub_gfxmenu_update_all(view);
else
grub_gui_iterate_recursively ((grub_gui_component_t) view->canvas,
redraw_menu_visit, view);
}
}
void
grub_gfxmenu_set_chosen_entry (int entry, void *data)
{
@@ -408,6 +424,8 @@ grub_gfxmenu_set_chosen_entry (int entry, void *data)
view->selected = entry;
grub_gfxmenu_redraw_menu (view);
}
static void

View File

@@ -33,6 +33,9 @@
#include <grub/gfxterm.h>
#include <grub/dl.h>
#include <grub/env.h>
#include <grub/extcmd.h>
#include <grub/ventoy.h>
#include "ventoy/ventoy_def.h"
int g_ventoy_menu_refresh = 0;
int g_ventoy_memdisk_mode = 0;
@@ -381,10 +384,34 @@ grub_menu_execute_with_fallback (grub_menu_t menu,
static struct grub_menu_viewer *viewers;
int g_menu_update_mode = 0;
int g_ventoy_tip_label_enable = 0;
const char * g_ventoy_tip_msg1 = NULL;
const char * g_ventoy_tip_msg2 = NULL;
static void menu_set_chosen_tip(grub_menu_t menu, int entry)
{
img_info *img;
grub_menu_entry_t e = grub_menu_get_entry (menu, entry);
g_ventoy_tip_msg1 = g_ventoy_tip_msg2 = NULL;
if (e && e->id && grub_strncmp(e->id, "VID_", 4) == 0)
{
img = (img_info *)(void *)grub_strtoul(e->id + 4, NULL, 16);
if (img)
{
g_ventoy_tip_msg1 = img->tip1;
g_ventoy_tip_msg2 = img->tip2;
}
}
}
static void
menu_set_chosen_entry (int entry)
menu_set_chosen_entry (grub_menu_t menu, int entry)
{
struct grub_menu_viewer *cur;
menu_set_chosen_tip(menu, entry);
for (cur = viewers; cur; cur = cur->next)
cur->set_chosen_entry (entry, cur->data);
}
@@ -680,6 +707,7 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
current_entry = default_entry;
refresh:
menu_set_chosen_tip(menu, current_entry);
menu_init (current_entry, menu, nested);
/* Initialize the time. */
@@ -732,13 +760,13 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
case GRUB_TERM_KEY_HOME:
case GRUB_TERM_CTRL | 'a':
current_entry = 0;
menu_set_chosen_entry (current_entry);
menu_set_chosen_entry (menu, current_entry);
break;
case GRUB_TERM_KEY_END:
case GRUB_TERM_CTRL | 'e':
current_entry = menu->size - 1;
menu_set_chosen_entry (current_entry);
menu_set_chosen_entry (menu, current_entry);
break;
case GRUB_TERM_KEY_UP:
@@ -746,7 +774,7 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
case '^':
if (current_entry > 0)
current_entry--;
menu_set_chosen_entry (current_entry);
menu_set_chosen_entry (menu, current_entry);
break;
case GRUB_TERM_CTRL | 'n':
@@ -754,7 +782,7 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
case 'v':
if (current_entry < menu->size - 1)
current_entry++;
menu_set_chosen_entry (current_entry);
menu_set_chosen_entry (menu, current_entry);
break;
case GRUB_TERM_CTRL | 'g':
@@ -763,7 +791,7 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
current_entry = 0;
else
current_entry -= GRUB_MENU_PAGE_SIZE;
menu_set_chosen_entry (current_entry);
menu_set_chosen_entry (menu, current_entry);
break;
case GRUB_TERM_CTRL | 'c':
@@ -772,7 +800,7 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
current_entry += GRUB_MENU_PAGE_SIZE;
else
current_entry = menu->size - 1;
menu_set_chosen_entry (current_entry);
menu_set_chosen_entry (menu, current_entry);
break;
case '\n':

View File

@@ -53,6 +53,26 @@ void ventoy_debug(const char *fmt, ...)
va_end (args);
}
void ventoy_str_tolower(char *str)
{
while (*str)
{
*str = grub_tolower(*str);
str++;
}
}
void ventoy_str_toupper(char *str)
{
while (*str)
{
*str = grub_toupper(*str);
str++;
}
}
int ventoy_strcmp(const char *pattern, const char *str)
{
while (*pattern && *str)

View File

@@ -1562,6 +1562,7 @@ static int ventoy_collect_img_files(const char *filename, const struct grub_dirh
grub_size_t len;
img_info *img;
img_info *tail;
const menu_tip *tip;
img_iterator_node *tmp;
img_iterator_node *new_node;
img_iterator_node *node = (img_iterator_node *)data;
@@ -1779,6 +1780,14 @@ static int ventoy_collect_img_files(const char *filename, const struct grub_dirh
g_ventoy_img_count++;
img->alias = ventoy_plugin_get_menu_alias(vtoy_alias_image_file, img->path);
tip = ventoy_plugin_get_menu_tip(img->path);
if (tip)
{
img->tip1 = tip->tip1;
img->tip2 = tip->tip2;
}
img->class = ventoy_plugin_get_menu_class(vtoy_class_image_file, img->name, img->path);
if (!img->class)
{
@@ -2073,23 +2082,23 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node)
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"
"menuentry \"%-10s %s%s\" --class=\"%s\" --id=\"VID_%p\" {\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->alias ? img->alias : img->name, img->class, img,
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"
"menuentry \"%s%s\" --class=\"%s\" --id=\"VID_%p\" {\n"
" %s_%s \n"
"}\n",
img->unsupport ? "[***********] " : "",
img->alias ? img->alias : img->name, img->class, img->id,
img->alias ? img->alias : img->name, img->class, img,
img->menu_prefix,
img->unsupport ? "unsupport_menuentry" : "common_menuentry");
}
@@ -2136,7 +2145,7 @@ static int ventoy_set_default_menu(void)
if (0 == g_default_menu_mode)
{
vtoy_ssprintf(g_list_script_buf, g_list_script_pos, "set default='VID_%d'\n", default_node->id);
vtoy_ssprintf(g_list_script_buf, g_list_script_pos, "set default='VID_%p'\n", default_node);
}
else
{
@@ -2169,7 +2178,7 @@ static int ventoy_set_default_menu(void)
pos = end + 1;
}
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, "VID_%d'\n", default_node->id);
vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, "VID_%p'\n", default_node);
grub_free(def);
}
}
@@ -2266,7 +2275,7 @@ static grub_err_t ventoy_cmd_ext_select_img_path(grub_extcmd_context_t ctxt, int
return grub_error(GRUB_ERR_BAD_ARGUMENT, "No such image");
}
grub_snprintf(id, sizeof(id), "VID_%d", cur->id);
grub_snprintf(id, sizeof(id), "VID_%p", cur);
grub_env_set("chosen", id);
grub_env_export("chosen");
@@ -2275,11 +2284,10 @@ static grub_err_t ventoy_cmd_ext_select_img_path(grub_extcmd_context_t ctxt, int
static grub_err_t ventoy_cmd_chosen_img_path(grub_extcmd_context_t ctxt, int argc, char **args)
{
int img_id = 0;
char value[32];
char *pos = NULL;
const char *id = NULL;
img_info *cur = g_ventoy_img_list;
img_info *cur = NULL;
(void)ctxt;
@@ -2293,20 +2301,11 @@ static grub_err_t ventoy_cmd_chosen_img_path(grub_extcmd_context_t ctxt, int arg
pos = grub_strstr(id, "VID_");
if (pos)
{
img_id = (int)grub_strtoul(pos + 4, NULL, 10);
cur = (img_info *)(void *)grub_strtoul(pos + 4, NULL, 16);
}
else
{
img_id = (int)grub_strtoul(id, NULL, 10);
}
while (cur)
{
if (img_id == cur->id)
{
break;
}
cur = cur->next;
cur = g_ventoy_img_list;
}
if (!cur)
@@ -2335,12 +2334,14 @@ 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 *min = NULL;
img_info *head = NULL;
const char *strdata = NULL;
char *device_name = NULL;
char buf[32];
img_iterator_node *node = NULL;
img_iterator_node *tmp = NULL;
(void)ctxt;
if (argc != 2)
@@ -2470,17 +2471,49 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char
}
/* sort image list by image name */
for (cur = g_ventoy_img_list; cur; cur = cur->next)
while (g_ventoy_img_list)
{
for (tail = cur->next; tail; tail = tail->next)
min = g_ventoy_img_list;
for (cur = g_ventoy_img_list->next; cur; cur = cur->next)
{
if (ventoy_cmp_img(cur, tail) > 0)
if (ventoy_cmp_img(min, cur) > 0)
{
ventoy_swap_img(cur, tail);
min = cur;
}
}
if (min->prev)
{
min->prev->next = min->next;
}
if (min->next)
{
min->next->prev = min->prev;
}
if (min == g_ventoy_img_list)
{
g_ventoy_img_list = min->next;
}
if (head == NULL)
{
head = tail = min;
min->prev = NULL;
min->next = NULL;
}
else
{
tail->next = min;
min->prev = tail;
min->next = NULL;
tail = min;
}
}
g_ventoy_img_list = head;
if (g_default_menu_mode == 1)
{
vtoy_ssprintf(g_list_script_buf, g_list_script_pos,
@@ -2492,11 +2525,11 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char
for (cur = g_ventoy_img_list; cur; cur = cur->next)
{
vtoy_ssprintf(g_list_script_buf, g_list_script_pos,
"menuentry \"%s%s\" --class=\"%s\" --id=\"VID_%d\" {\n"
"menuentry \"%s%s\" --class=\"%s\" --id=\"VID_%p\" {\n"
" %s_%s \n"
"}\n",
cur->unsupport ? "[***********] " : "",
cur->alias ? cur->alias : cur->name, cur->class, cur->id,
cur->alias ? cur->alias : cur->name, cur->class, cur,
cur->menu_prefix,
cur->unsupport ? "unsupport_menuentry" : "common_menuentry");
}
@@ -4851,6 +4884,27 @@ static grub_err_t grub_cmd_gptpriority(grub_extcmd_context_t ctxt, int argc, cha
}
/* <BEGIN>: Deleted by longpanda, 20210916 PN:XX LABEL:XX */
#if 0
void ventoy_tip_set_menu_label(const char *vid)
{
img_info *node;
g_ventoy_tip_msg1 = g_ventoy_tip_msg2 = NULL;
if (vid)
{
node = (img_info *)(void *)grub_strtoul(vid + 4, NULL, 16);
if (node)
{
g_ventoy_tip_msg1 = node->tip1;
g_ventoy_tip_msg2 = node->tip2;
}
}
}
#endif /* #if 0 */
/* <END> : Deleted by longpanda, 20210916 PN:XX LABEL:XX */
int ventoy_env_init(void)
{
char buf[64];

View File

@@ -215,6 +215,8 @@ typedef struct img_info
char name[256];
const char *alias;
const char *tip1;
const char *tip2;
const char *class;
const char *menu_prefix;
@@ -432,6 +434,18 @@ typedef struct wim_directory_entry
/** No security information exists for this file */
#define WIM_NO_SECURITY 0xffffffffUL
typedef struct reg_vk
{
grub_uint32_t res1;
grub_uint16_t sig;
grub_uint16_t namesize;
grub_uint32_t datasize;
grub_uint32_t dataoffset;
grub_uint32_t datatype;
grub_uint16_t flag;
grub_uint16_t res2;
}reg_vk;
#pragma pack()
@@ -865,6 +879,17 @@ typedef struct menu_alias
struct menu_alias *next;
}menu_alias;
typedef struct menu_tip
{
int pathlen;
char isopath[256];
char tip1[1024];
char tip2[1024];
struct menu_tip *next;
}menu_tip;
#define vtoy_class_image_file 0
#define vtoy_class_directory 1
@@ -1004,6 +1029,8 @@ extern grub_uint32_t g_ventoy_plat_data;
#define ventoy_syscall0(name) grub_##name()
#define ventoy_syscall1(name, a) grub_##name(a)
void ventoy_str_tolower(char *str);
void ventoy_str_toupper(char *str);
char * ventoy_get_line(char *start);
int ventoy_cmp_img(img_info *img1, img_info *img2);
void ventoy_swap_img(img_info *img1, img_info *img2);
@@ -1017,6 +1044,7 @@ int ventoy_fill_windows_rtdata(void *buf, char *isopath);
int ventoy_plugin_get_persistent_chunklist(const char *isopath, int index, ventoy_img_chunk_list *chunk_list);
const char * ventoy_plugin_get_injection(const char *isopath);
const char * ventoy_plugin_get_menu_alias(int type, const char *isopath);
const menu_tip * ventoy_plugin_get_menu_tip(const char *isopath);
const char * ventoy_plugin_get_menu_class(int type, const char *name, const char *path);
int ventoy_plugin_check_memdisk(const char *isopath);
int ventoy_plugin_get_image_list_index(int type, const char *name);
@@ -1074,5 +1102,7 @@ int ventoy_chain_file_read(const char *path, int offset, int len, void *buf);
grub_env_export(env);\
}
#define ret_goto_end(a) ret = a; goto end;
#endif /* __VENTOY_DEF_H__ */

View File

@@ -48,6 +48,7 @@ static install_template *g_install_template_head = NULL;
static dud *g_dud_head = NULL;
static menu_password *g_pwd_head = NULL;
static persistence_config *g_persistence_head = NULL;
static menu_tip *g_menu_tip_head = NULL;
static menu_alias *g_menu_alias_head = NULL;
static menu_class *g_menu_class_head = NULL;
static custom_boot *g_custom_boot_head = NULL;
@@ -1417,6 +1418,176 @@ static int ventoy_plugin_menualias_entry(VTOY_JSON *json, const char *isodisk)
return 0;
}
static int ventoy_plugin_menutip_check(VTOY_JSON *json, const char *isodisk)
{
const char *path = NULL;
const char *tip = NULL;
VTOY_JSON *pNode = NULL;
(void)isodisk;
if (json->enDataType != JSON_TYPE_OBJECT)
{
grub_printf("Not object %d\n", json->enDataType);
return 1;
}
tip = vtoy_json_get_string_ex(json->pstChild, "left");
if (tip)
{
grub_printf("left: <%s>\n", tip);
}
tip = vtoy_json_get_string_ex(json->pstChild, "top");
if (tip)
{
grub_printf("top: <%s>\n", tip);
}
tip = vtoy_json_get_string_ex(json->pstChild, "color");
if (tip)
{
grub_printf("color: <%s>\n", tip);
}
pNode = vtoy_json_find_item(json->pstChild, JSON_TYPE_ARRAY, "tips");
for (pNode = pNode->pstChild; pNode; pNode = pNode->pstNext)
{
path = vtoy_json_get_string_ex(pNode->pstChild, "image");
if (path && path[0] == '/')
{
if (grub_strchr(path, '*'))
{
grub_printf("image: <%s> [ * ]\n", path);
}
else if (ventoy_check_file_exist("%s%s", isodisk, path))
{
grub_printf("image: <%s> [ OK ]\n", path);
}
else
{
grub_printf("image: <%s> [ NOT EXIST ]\n", path);
}
tip = vtoy_json_get_string_ex(pNode->pstChild, "tip");
if (tip)
{
grub_printf("tip: <%s>\n", tip);
}
else
{
tip = vtoy_json_get_string_ex(pNode->pstChild, "tip1");
if (tip)
grub_printf("tip1: <%s>\n", tip);
else
grub_printf("tip1: <NULL>\n");
tip = vtoy_json_get_string_ex(pNode->pstChild, "tip2");
if (tip)
grub_printf("tip2: <%s>\n", tip);
else
grub_printf("tip2: <NULL>\n");
}
}
else
{
grub_printf("image: <%s> [ INVALID ]\n", path);
}
}
return 0;
}
static int ventoy_plugin_menutip_entry(VTOY_JSON *json, const char *isodisk)
{
const char *path = NULL;
const char *tip = NULL;
VTOY_JSON *pNode = NULL;
menu_tip *node = NULL;
menu_tip *next = NULL;
(void)isodisk;
if (json->enDataType != JSON_TYPE_OBJECT)
{
debug("Not object %d\n", json->enDataType);
return 0;
}
pNode = vtoy_json_find_item(json->pstChild, JSON_TYPE_ARRAY, "tips");
if (pNode == NULL)
{
debug("Not tips found\n");
return 0;
}
if (g_menu_tip_head)
{
for (node = g_menu_tip_head; node; node = next)
{
next = node->next;
grub_free(node);
}
g_menu_tip_head = NULL;
}
tip = vtoy_json_get_string_ex(json->pstChild, "left");
if (tip)
{
grub_env_set("VTOY_TIP_LEFT", tip);
}
tip = vtoy_json_get_string_ex(json->pstChild, "top");
if (tip)
{
grub_env_set("VTOY_TIP_TOP", tip);
}
tip = vtoy_json_get_string_ex(json->pstChild, "color");
if (tip)
{
grub_env_set("VTOY_TIP_COLOR", tip);
}
for (pNode = pNode->pstChild; pNode; pNode = pNode->pstNext)
{
path = vtoy_json_get_string_ex(pNode->pstChild, "image");
if (path && path[0] == '/')
{
node = grub_zalloc(sizeof(menu_tip));
if (node)
{
node->pathlen = grub_snprintf(node->isopath, sizeof(node->isopath), "%s", path);
tip = vtoy_json_get_string_ex(pNode->pstChild, "tip");
if (tip)
{
grub_snprintf(node->tip1, 1000, "%s", tip);
}
else
{
tip = vtoy_json_get_string_ex(pNode->pstChild, "tip1");
if (tip)
grub_snprintf(node->tip1, 1000, "%s", tip);
tip = vtoy_json_get_string_ex(pNode->pstChild, "tip2");
if (tip)
grub_snprintf(node->tip2, 1000, "%s", tip);
}
if (g_menu_tip_head)
{
node->next = g_menu_tip_head;
}
g_menu_tip_head = node;
}
}
}
return 0;
}
static int ventoy_plugin_injection_check(VTOY_JSON *json, const char *isodisk)
{
@@ -2101,6 +2272,7 @@ static plugin_entry g_plugin_entries[] =
{ "auto_install", ventoy_plugin_auto_install_entry, ventoy_plugin_auto_install_check },
{ "persistence", ventoy_plugin_persistence_entry, ventoy_plugin_persistence_check },
{ "menu_alias", ventoy_plugin_menualias_entry, ventoy_plugin_menualias_check },
{ "menu_tip", ventoy_plugin_menutip_entry, ventoy_plugin_menutip_check },
{ "menu_class", ventoy_plugin_menuclass_entry, ventoy_plugin_menuclass_check },
{ "injection", ventoy_plugin_injection_entry, ventoy_plugin_injection_check },
{ "auto_memdisk", ventoy_plugin_auto_memdisk_entry, ventoy_plugin_auto_memdisk_check },
@@ -2149,6 +2321,11 @@ grub_err_t ventoy_cmd_load_plugin(grub_extcmd_context_t ctxt, int argc, char **a
(void)ctxt;
(void)argc;
grub_env_set("VTOY_TIP_LEFT", "10%");
grub_env_set("VTOY_TIP_TOP", "80%+5");
grub_env_set("VTOY_TIP_COLOR", "blue");
grub_env_set("VTOY_TIP_ALIGN", "left");
file = ventoy_grub_file_open(GRUB_FILE_TYPE_LINUX_INITRD, "%s/ventoy/ventoy.json", args[0]);
if (!file)
{
@@ -2205,6 +2382,15 @@ grub_err_t ventoy_cmd_load_plugin(grub_extcmd_context_t ctxt, int argc, char **a
}
}
if (g_menu_tip_head)
{
grub_env_set("VTOY_MENU_TIP_ENABLE", "1");
}
else
{
grub_env_unset("VTOY_MENU_TIP_ENABLE");
}
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
}
@@ -2465,6 +2651,28 @@ const char * ventoy_plugin_get_menu_alias(int type, const char *isopath)
return NULL;
}
const menu_tip * ventoy_plugin_get_menu_tip(const char *isopath)
{
int len;
menu_tip *node = NULL;
if (!g_menu_tip_head)
{
return NULL;
}
len = (int)grub_strlen(isopath);
for (node = g_menu_tip_head; node; node = node->next)
{
if (node->pathlen == len && ventoy_strcmp(node->isopath, isopath) == 0)
{
return node;
}
}
return NULL;
}
const char * ventoy_plugin_get_menu_class(int type, const char *name, const char *path)
{
int namelen;

View File

@@ -658,28 +658,6 @@ static wim_directory_entry * search_full_wim_dirent
return search;
}
static wim_directory_entry * search_replace_wim_dirent(void *meta_data, wim_directory_entry *dir)
{
wim_directory_entry *wim_dirent = NULL;
const char *pecmd_path[] = { "Windows", "System32", "pecmd.exe", NULL };
const char *winpeshl_path[] = { "Windows", "System32", "winpeshl.exe", NULL };
wim_dirent = search_full_wim_dirent(meta_data, dir, pecmd_path);
debug("search pecmd.exe %p\n", wim_dirent);
if (wim_dirent)
{
return wim_dirent;
}
wim_dirent = search_full_wim_dirent(meta_data, dir, winpeshl_path);
debug("search winpeshl.exe %p\n", wim_dirent);
if (wim_dirent)
{
return wim_dirent;
}
return NULL;
}
static wim_lookup_entry * ventoy_find_look_entry(wim_header *header, wim_lookup_entry *lookup, wim_hash *hash)
@@ -697,6 +675,178 @@ static wim_lookup_entry * ventoy_find_look_entry(wim_header *header, wim_lookup_
return NULL;
}
static int parse_registry_setup_cmdline
(
grub_file_t file,
wim_header *head,
wim_lookup_entry *lookup,
void *meta_data,
wim_directory_entry *dir,
char *buf,
grub_uint32_t buflen
)
{
char c;
int ret = 0;
grub_uint32_t i = 0;
grub_uint32_t reglen = 0;
wim_hash zerohash;
reg_vk *regvk = NULL;
wim_lookup_entry *look = NULL;
wim_directory_entry *wim_dirent = NULL;
char *decompress_data = NULL;
const char *reg_path[] = { "Windows", "System32", "config", "SYSTEM", NULL };
wim_dirent = search_full_wim_dirent(meta_data, dir, reg_path);
debug("search reg SYSTEM %p\n", wim_dirent);
if (!wim_dirent)
{
return 1;
}
grub_memset(&zerohash, 0, sizeof(zerohash));
if (grub_memcmp(&zerohash, wim_dirent->hash.sha1, sizeof(wim_hash)) == 0)
{
return 2;
}
look = ventoy_find_look_entry(head, lookup, &wim_dirent->hash);
if (!look)
{
return 3;
}
reglen = (grub_uint32_t)look->resource.raw_size;
debug("find system lookup entry_id:%ld raw_size:%u\n",
((long)look - (long)lookup) / sizeof(wim_lookup_entry), reglen);
if (0 != ventoy_read_resource(file, head, &(look->resource), (void **)&(decompress_data)))
{
return 4;
}
if (grub_strncmp(decompress_data + 0x1000, "hbin", 4))
{
ret_goto_end(5);
}
for (i = 0x1000; i + sizeof(reg_vk) < reglen; i += 8)
{
regvk = (reg_vk *)(decompress_data + i);
if (regvk->sig == 0x6B76 && regvk->namesize == 7 &&
regvk->datatype == 1 && regvk->flag == 1)
{
if (grub_strncasecmp((char *)(regvk + 1), "cmdline", 7) == 0)
{
debug("find registry cmdline i:%u offset:(0x%x)%u size:(0x%x)%u\n",
i, regvk->dataoffset, regvk->dataoffset, regvk->datasize, regvk->datasize);
break;
}
}
}
if (i + sizeof(reg_vk) >= reglen || regvk == NULL)
{
ret_goto_end(6);
}
if (regvk->datasize == 0 || (regvk->datasize & 0x80000000) > 0 ||
regvk->dataoffset == 0 || regvk->dataoffset == 0xFFFFFFFF)
{
ret_goto_end(7);
}
if (regvk->datasize / 2 >= buflen)
{
ret_goto_end(8);
}
debug("start offset is 0x%x(%u)\n", 0x1000 + regvk->dataoffset + 4, 0x1000 + regvk->dataoffset + 4);
for (i = 0; i < regvk->datasize; i+=2)
{
c = (char)(*(grub_uint16_t *)(decompress_data + 0x1000 + regvk->dataoffset + 4 + i));
*buf++ = c;
}
ret = 0;
end:
grub_check_free(decompress_data);
return ret;
}
static wim_directory_entry * search_replace_wim_dirent
(
grub_file_t file,
wim_header *head,
wim_lookup_entry *lookup,
void *meta_data,
wim_directory_entry *dir
)
{
int ret;
char cmdline[256] = {0};
wim_directory_entry *wim_dirent = NULL;
wim_directory_entry *pecmd_dirent = NULL;
const char *peset_path[] = { "Windows", "System32", "peset.exe", NULL };
const char *pecmd_path[] = { "Windows", "System32", "pecmd.exe", NULL };
const char *winpeshl_path[] = { "Windows", "System32", "winpeshl.exe", NULL };
pecmd_dirent = search_full_wim_dirent(meta_data, dir, pecmd_path);
debug("search pecmd.exe %p\n", pecmd_dirent);
if (pecmd_dirent)
{
ret = parse_registry_setup_cmdline(file, head, lookup, meta_data, dir, cmdline, sizeof(cmdline));
if (0 == ret)
{
debug("registry setup cmdline:<%s>\n", cmdline);
ventoy_str_toupper(cmdline);
if (grub_strncmp(cmdline, "PECMD", 5) == 0)
{
wim_dirent = pecmd_dirent;
}
else if (grub_strncmp(cmdline, "PESET", 5) == 0)
{
wim_dirent = search_full_wim_dirent(meta_data, dir, peset_path);
debug("search peset.exe %p\n", wim_dirent);
}
else if (grub_strncmp(cmdline, "WINPESHL", 8) == 0)
{
wim_dirent = search_full_wim_dirent(meta_data, dir, winpeshl_path);
debug("search winpeshl.exe %p\n", wim_dirent);
}
if (wim_dirent)
{
return wim_dirent;
}
}
else
{
debug("registry setup cmdline failed : %d\n", ret);
}
}
wim_dirent = pecmd_dirent;
if (wim_dirent)
{
return wim_dirent;
}
wim_dirent = search_full_wim_dirent(meta_data, dir, winpeshl_path);
debug("search winpeshl.exe %p\n", wim_dirent);
if (wim_dirent)
{
return wim_dirent;
}
return NULL;
}
static wim_lookup_entry * ventoy_find_meta_entry(wim_header *header, wim_lookup_entry *lookup)
{
grub_uint32_t i = 0;
@@ -1008,8 +1158,16 @@ static int ventoy_wimdows_locate_wim(const char *disk, wim_patch *patch)
rootdir = (wim_directory_entry *)(decompress_data + 8);
}
debug("read lookup offset:%llu size:%llu\n", (ulonglong)head->lookup.offset, (ulonglong)head->lookup.raw_size);
lookup = grub_malloc(head->lookup.raw_size);
grub_file_seek(file, head->lookup.offset);
grub_file_read(file, lookup, head->lookup.raw_size);
/* search winpeshl.exe dirent entry */
search = search_replace_wim_dirent(decompress_data, rootdir);
search = search_replace_wim_dirent(file, head, lookup, decompress_data, rootdir);
if (!search)
{
debug("Failed to find replace file %p\n", search);
@@ -1041,11 +1199,7 @@ static int ventoy_wimdows_locate_wim(const char *disk, wim_patch *patch)
grub_memcpy(&patch->old_hash, search->hash.sha1, sizeof(wim_hash));
}
debug("read lookup offset:%llu size:%llu\n", (ulonglong)head->lookup.offset, (ulonglong)head->lookup.raw_size);
lookup = grub_malloc(head->lookup.raw_size);
grub_file_seek(file, head->lookup.offset);
grub_file_read(file, lookup, head->lookup.raw_size);
/* find and extact winpeshl.exe */
patch->replace_look = ventoy_find_look_entry(head, lookup, &patch->old_hash);
if (patch->replace_look)

View File

@@ -25,13 +25,25 @@ porteus_hook() {
if $GREP -q exfat /proc/filesystems; then
vtPath=$($VTOY_PATH/tool/vtoydump -p $VTOY_PATH/ventoy_os_param)
vtFindFlag=0
$GREP '`value from`' /usr/* -r | $AWK -F: '{print $1}' | while read vtline; do
echo "hooking $vtline ..." >> $VTLOG
$SED "s#\`value from\`#$vtPath#g" -i $vtline
vtFindFlag=1
done
if [ $vtFindFlag -eq 0 ]; then
if $GREP -q '`value from`' /linuxrc; then
echo "hooking linuxrc ..." >> $VTLOG
$SED "/searching *for *\$CFG *file/i$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/porteus-path.sh" -i /linuxrc
$SED "/searching *for *\$CFG *file/iFROM=\$(cat /porteus-from)" -i /linuxrc
$SED "/searching *for *\$CFG *file/iISO=\$(cat /porteus-from)" -i /linuxrc
vtFindFlag=1
fi
fi
else
for vtfile in '/init' '/linuxrc' ; do
for vtfile in '/linuxrc' '/init'; do
if [ -e $vtfile ]; then
if ! $GREP -q ventoy $vtfile; then
echo "hooking $vtfile ..." >> $VTLOG

View File

@@ -0,0 +1,38 @@
#!/ventoy/busybox/sh
#************************************************************************************
# Copyright (c) 2020, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
. /ventoy/hook/ventoy-hook-lib.sh
vtlog "####### $0 $* ########"
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
wait_for_usb_disk_ready
vtdiskname=$(get_ventoy_disk_name)
vtPath=$(vtoydump -p $VTOY_PATH/ventoy_os_param)
if echo $vtdiskname | egrep -q "nvme|mmc|nbd"; then
echo ${vtdiskname}p1${vtPath} > /porteus-from
else
echo ${vtdiskname}1${vtPath} > /porteus-from
fi
PATH=$VTPATH_OLD

View File

@@ -27,6 +27,33 @@ vtlog "####### $0 $* ########"
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
ventoy_os_install_dmsetup_by_fuse() {
vtlog "ventoy_os_install_dmsetup_by_fuse $*"
mkdir -p $VTOY_PATH/mnt/fuse $VTOY_PATH/mnt/iso $VTOY_PATH/mnt/squashfs
vtoydm -p -f $VTOY_PATH/ventoy_image_map -d $1 > $VTOY_PATH/ventoy_dm_table
vtoy_fuse_iso -f $VTOY_PATH/ventoy_dm_table -m $VTOY_PATH/mnt/fuse
mount -t iso9660 $VTOY_PATH/mnt/fuse/ventoy.iso $VTOY_PATH/mnt/iso
sfsfile=$(ls $VTOY_PATH/mnt/iso/*.sfs)
mount -t squashfs $sfsfile $VTOY_PATH/mnt/squashfs
kVer=$(uname -r)
KoName=$(ls $VTOY_PATH/mnt/squashfs/lib/modules/$kVer/kernel/drivers/md/dm-mod.ko*)
vtlog "insmod $KoName"
insmod $KoName
umount $VTOY_PATH/mnt/squashfs
umount $VTOY_PATH/mnt/iso
umount $VTOY_PATH/mnt/fuse
}
wait_for_usb_disk_ready
vtdiskname=$(get_ventoy_disk_name)
@@ -36,6 +63,12 @@ if [ "$vtdiskname" = "unknown" ]; then
exit 0
fi
if grep -q 'device-mapper' /proc/devices; then
vtlog "device-mapper module exist"
else
ventoy_os_install_dmsetup_by_fuse $vtdiskname
fi
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
if ! [ -e $VTOY_DM_PATH ]; then

View File

@@ -18,8 +18,15 @@
#************************************************************************************
$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='ventoy|iso9660'" -i /init
if $GREP -q 'HAVE_PARTS=' /init; then
$SED "/^ *HAVE_PARTS=/a\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/puppy-disk.sh" -i /init
$SED "/^ *HAVE_PARTS=/a\ HAVE_PARTS='ventoy|iso9660'" -i /init
elif $GREP -q 'LESSPARTS=' /init; then
$SED "/^ *LESSPARTS=/a\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/puppy-disk.sh" -i /init
$SED "/^ *LESSPARTS=/a\ LESSPARTS='ventoy|iso9660'" -i /init
fi
if [ -f /DISTRO_SPECS ]; then
if ! [ -d /dev ]; then

View File

@@ -35,7 +35,7 @@ ventoy_get_debian_distro() {
fi
if [ -e /init ]; then
if $GREP -q PUPPYSFS /init; then
if $EGREP -q 'PUPPYSFS|PUPPYFILE' /init; then
if $GREP -q VEKETSFS /init; then
echo 'veket'; return
else

View File

@@ -0,0 +1,7 @@
preseed/file
debian-installer/locale
console-keymaps-at/keymap
keyboard-configuration/xkb-keymap
keyboard-configuration/layout
simple-cdd/profiles
vga

View File

@@ -185,7 +185,7 @@ ventoy_unpack_injection() {
if [ -e $VTOY_PATH/ventoy_injection ]; then
echo "### decompress injection ... ###" >>$VTLOG
ventoy_unpack_injection > $VTOY_PATH/injection.log 2>&1
ventoy_unpack_injection > $VTOY_PATH/injection.log 2>&1
fi

View File

@@ -52,8 +52,20 @@ ventoy_get_os_type() {
fi
fi
# Debian :
if $GREP -q '[Dd]ebian' /proc/version; then
echo 'debian'; return
# Ubuntu : do the same process with debian
elif $GREP -q '[Uu]buntu' /proc/version; then
echo 'debian'; return
# Deepin : do the same process with debian
elif $GREP -q '[Dd]eepin' /proc/version; then
echo 'debian'; return
# rhel5/CentOS5 and all other distributions based on them
if $GREP -q 'el5' /proc/version; then
elif $GREP -q 'el5' /proc/version; then
echo 'rhel5'; return
# rhel6/CentOS6 and all other distributions based on them
@@ -78,18 +90,6 @@ ventoy_get_os_type() {
elif $GREP -q '\.fc[0-9][0-9]\.' /proc/version; then
echo 'rhel7'; return
# Debian :
elif $GREP -q '[Dd]ebian' /proc/version; then
echo 'debian'; return
# Ubuntu : do the same process with debian
elif $GREP -q '[Uu]buntu' /proc/version; then
echo 'debian'; return
# Deepin : do the same process with debian
elif $GREP -q '[Dd]eepin' /proc/version; then
echo 'debian'; return
# SUSE
elif $GREP -q 'SUSE' /proc/version; then
echo 'suse'; return
@@ -160,7 +160,11 @@ ventoy_get_os_type() {
elif $GREP -q 'openEuler' /etc/os-release; then
echo 'openEuler'; return
elif $GREP -q 'fuyu' /etc/os-release; then
echo 'openEuler'; return
echo 'openEuler'; return
elif $GREP -q 'deepin' /etc/os-release; then
echo 'debian'; return
elif $GREP -q 'chinauos' /etc/os-release; then
echo 'debian'; return
fi
fi
@@ -344,9 +348,36 @@ if [ -e "$VTOY_PATH/hook/$VTOS/ventoy-hook.sh" ]; then
fi
if $GREP -q -i Untangle /proc/version; then
for vtPara in $($CAT /proc/cmdline); do
vtItemkey=$(echo $vtPara | $AWK -F= '{print $1}')
vtItemVal=$(echo $vtPara | $AWK -F= '{print $2}')
if $GREP -q -m1 "^$vtItemkey\$" $VTOY_PATH/hook/default/export.list; then
vtEnvExport="$vtEnvExport $vtItemkey=$vtItemVal"
fi
done
echo "================ env export ================" >> $VTLOG
echo $vtEnvExport >> $VTLOG
echo "============================================" >> $VTLOG
fi
####################################################################
# #
# Step 3 : Check for debug break #
# Step 3 : Run LiveInjection Hook #
# #
####################################################################
if [ -f "/live_injection_7ed136ec_7a61_4b54_adc3_ae494d5106ea/hook.sh" ]; then
$BUSYBOX_PATH/sh "/live_injection_7ed136ec_7a61_4b54_adc3_ae494d5106ea/hook.sh" $VTOS
fi
####################################################################
# #
# Step 4 : Check for debug break #
# #
####################################################################
if [ "$VTOY_BREAK_LEVEL" = "03" ] || [ "$VTOY_BREAK_LEVEL" = "13" ]; then
@@ -363,7 +394,7 @@ fi
####################################################################
# #
# Step 4 : Hand over to real init #
# Step 5 : Hand over to real init #
# #
####################################################################
$BUSYBOX_PATH/umount /proc
@@ -392,7 +423,12 @@ for vtinit in $user_rdinit /init /sbin/init /linuxrc; do
if [ -f "$VTOY_PATH/hook/$VTOS/ventoy-before-init.sh" ]; then
$BUSYBOX_PATH/sh "$VTOY_PATH/hook/$VTOS/ventoy-before-init.sh"
fi
exec "$vtinit"
if [ -z "$vtEnvExport" ]; then
exec "$vtinit"
else
exec env $vtEnvExport "$vtinit"
fi
fi
fi
done

View File

@@ -127,8 +127,8 @@ ventoy_get_os_type() {
# Deepin : do the same process with debian
elif $GREP -q '[Dd]eepin' /proc/version; then
echo 'debian'; return
echo 'debian'; return
# SUSE
elif $GREP -q 'SUSE' /proc/version; then
echo 'suse'; return
@@ -200,6 +200,10 @@ ventoy_get_os_type() {
echo 'openEuler'; return
elif $GREP -q 'fuyu' /etc/os-release; then
echo 'openEuler'; return
elif $GREP -q 'deepin' /etc/os-release; then
echo 'debian'; return
elif $GREP -q 'chinauos' /etc/os-release; then
echo 'debian'; return
fi
fi

View File

@@ -84,10 +84,15 @@ else
if $GREP -q 64 $VTOY_PATH/ventoy_arch; then
echo "use veritysetup64" >>$VTLOG
$BUSYBOX_PATH/cp -a $VTOY_PATH/tool/veritysetup64 $VTOY_PATH/tool/veritysetup
if [ -f $VTOY_PATH/tool/veritysetup64 ]; then
$BUSYBOX_PATH/cp -a $VTOY_PATH/tool/veritysetup64 $VTOY_PATH/tool/veritysetup
fi
else
echo "use veritysetup32" >>$VTLOG
$BUSYBOX_PATH/cp -a $VTOY_PATH/tool/veritysetup32 $VTOY_PATH/tool/veritysetup
if [ -f $VTOY_PATH/tool/veritysetup32 ]; then
$BUSYBOX_PATH/cp -a $VTOY_PATH/tool/veritysetup32 $VTOY_PATH/tool/veritysetup
fi
fi
fi

View File

@@ -62,6 +62,9 @@ cp -a $VENTOY_PATH/VBLADE/vblade-master/vblade_64 tool/
cp -a $VENTOY_PATH/LZIP/lunzip32 tool/
cp -a $VENTOY_PATH/LZIP/lunzip64 tool/
cp -a $VENTOY_PATH/cryptsetup/veritysetup32 tool/
cp -a $VENTOY_PATH/cryptsetup/veritysetup64 tool/
chmod -R 777 ./tool
find ./tool | cpio -o -H newc --owner=root:root >tool.cpio

View File

@@ -27,6 +27,13 @@ if [ ! -f "$file" ]; then
exit 1
fi
if echo $size | grep -q "^-"; then
mode="Shrink"
size=${size:1}
else
mode="Extend"
fi
if echo $size | grep -q "[^0-9]"; then
print_usage
exit 1
@@ -42,10 +49,25 @@ fi
fsMB=$(expr $fsize / 1024 / 1024)
total=$(expr $fsMB + $size)
if [ "$mode" = "Extend" ]; then
total=$(expr $fsMB + $size)
else
if [ $fsMB -le $size ]; then
echo "File size of $file is less than ${size}MB."
exit 1
fi
total=$(expr $fsMB - $size)
fi
magic=$(hexdump -n3 -e '3/1 "%02X"' $file)
if [ "$magic" = "584653" ]; then
if [ "$mode" = "Shrink" ]; then
echo "Shrink is not supported for XFS filesystem."
exit 1
fi
if which xfs_growfs >/dev/null 2>&1; then
cmd=xfs_growfs
else
@@ -61,23 +83,26 @@ else
fi
fi
if [ "$mode" = "Extend" ]; then
echo "$mode dat file... (current is ${fsMB}MB, append ${size}MB, total ${total}MB)"
dd if=/dev/zero bs=1M count=$size status=none >> "$file"
sync
else
echo "$mode dat file... (current is ${fsMB}MB, reduce ${size}MB, finally ${total}MB)"
fi
echo "Extend dat file... (current is ${fsMB}MB, append ${size}MB, total ${total}MB)"
dd if=/dev/zero bs=1M count=$size status=none >> "$file"
sync
freeloop=$(losetup -f)
losetup $freeloop "$file"
if [ "$cmd" = "resize2fs" ]; then
echo "Extend ext filesystem by resize2fs ..."
echo "$mode ext filesystem by resize2fs ..."
echo "resize2fs $freeloop ${total}M"
e2fsck -f $freeloop
resize2fs $freeloop ${total}M
ret=$?
else
echo "Extend xfs filesystem by xfs_growfs ..."
echo "$mode xfs filesystem by xfs_growfs ..."
tmpdir=$(mktemp -d)
mount $freeloop $tmpdir
xfs_growfs $freeloop
@@ -87,6 +112,12 @@ fi
losetup -d $freeloop
if [ $ret -eq 0 -a "$mode" = "Shrink" ]; then
echo "truncate persistent file ..."
truncate "$file" -s ${total}M
ret=$?
fi
echo ""
if [ $ret -eq 0 ]; then
echo "======= SUCCESS ========="
@@ -94,4 +125,3 @@ else
echo "======= FAILED ========="
fi
echo ""

View File

@@ -22,6 +22,12 @@ Please refer https://www.ventoy.net/en/doc_start.html for details.
2. open your browser and visit http://127.0.0.1:24680
========= VentoyGUI ===================
VentoyGUI is native GUI program for Linux (GTK/QT)
1. Just double-click the file (e.g. VentoyGUI.x86_64)
2. If it can not startup after double-click, you can open the terminal and just execute the file (e.g. ./VentoyGUI.x86_64)
========== CreatePersistentImg.sh ===============
sudo sh CreatePersistentImg.sh [ -s SIZE_IN_MB ] [ -t FSTYPE ] [ -l LABEL ] for example:

BIN
INSTALL/VentoyGUI.aarch64 Normal file

Binary file not shown.

BIN
INSTALL/VentoyGUI.i386 Normal file

Binary file not shown.

BIN
INSTALL/VentoyGUI.mips64el Normal file

Binary file not shown.

BIN
INSTALL/VentoyGUI.x86_64 Normal file

Binary file not shown.

View File

@@ -1,109 +0,0 @@
#!/bin/sh
if echo "$*" | grep -q '[-]v'; then
set -x
fi
print_usage() {
echo 'Usage: VentoyWebDeepin.sh [ OPTION ]'
echo ' OPTION: (optional)'
echo ' -H x.x.x.x http server IP address (default is 127.0.0.1)'
echo ' -p PORT http server PORT (default is 24680)'
echo ' -h print this help'
echo ' -v print verbose info'
echo ''
}
print_err() {
echo ""
echo "$*"
echo ""
}
get_user() {
name=$(logname)
if [ -n "$name" -a "$name" != "root" ]; then
echo $name; return
fi
name=${HOME#/home/}
if [ -n "$name" -a "$name" != "root" ]; then
echo $name; return
fi
}
uid=$(id -u)
if [ $uid -ne 0 ]; then
exec sudo sh $0 $*
fi
OLDDIR=$(pwd)
if uname -m | egrep -q 'aarch64|arm64'; then
TOOLDIR=aarch64
elif uname -m | egrep -q 'x86_64|amd64'; then
TOOLDIR=x86_64
elif uname -m | egrep -q 'mips64'; then
TOOLDIR=mips64el
else
TOOLDIR=i386
fi
if [ ! -f ./tool/$TOOLDIR/V2DServer ]; then
if [ -f ${0%VentoyWebDeepin.sh}/tool/$TOOLDIR/V2DServer ]; then
cd ${0%VentoyWebDeepin.sh}
fi
fi
PATH=./tool/$TOOLDIR:$PATH
if [ ! -f ./boot/boot.img ]; then
if [ -d ./grub ]; then
echo "Don't run VentoyWebDeepin.sh here, please download the released install package, and run the script in it."
else
echo "Please run under the correct directory!"
fi
exit 1
fi
HOST="127.0.0.1"
PORT=24680
while [ -n "$1" ]; do
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
print_usage
exit 0
elif [ "$1" = "-v" ]; then
VERBOSE=1
elif [ "$1" = "-H" ]; then
shift
if echo $1 | grep -q '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*'; then
HOST="$1"
else
print_err "Invalid host $1"
exit 1
fi
elif [ "$1" = "-p" ]; then
shift
if [ $1 -gt 0 -a $1 -le 65535 ]; then
PORT="$1"
else
print_err "Invalid port $1"
exit 1
fi
fi
shift
done
if ps -ef | grep "V2DServer.*$HOST.*$PORT" | grep -q -v grep; then
print_err "Another ventoy server is running now, please close it first."
exit 1
fi
if grep -q -i uos /etc/os-release; then
. ./tool/WebUos.sh
else
. ./tool/WebDeepin.sh
fi

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More