mirror of
https://github.com/ventoy/Ventoy.git
synced 2024-12-25 22:55:58 -05:00
1.0.05 release
1. Add backup thread in vtoyjump.exe 2. New iso support MXLinux 19.1 (Legacy + UEFI) KNOPPIX_V8.6-2019-08-08-EN.iso (Legacy) Puppy Linux, bionicpup64-8.0-uefi.iso (Legacy + UEFI) tails-amd64-4.5.iso (Legacy) slax-64bit-9.11.0.iso (Legacy) Kaspersky Rescue Disk 18 (Legacy + UEFI) Parted Magic 2018 Bootable ISO (Legacy + UEFI) veket_20.iso (Legacy) ZeroShell-3.9.3-X86.iso (Legacy) SuperGrub2Disk rescatux-0.73.iso (Legacy + UEFI) Some WinPE iso (Legacy + UEFI)
This commit is contained in:
parent
277b134bf6
commit
cd4a5fcb06
@ -15,7 +15,7 @@ fi
|
|||||||
export C_INCLUDE_PATH=$LIBFUSE_DIR/include
|
export C_INCLUDE_PATH=$LIBFUSE_DIR/include
|
||||||
|
|
||||||
rm -f $name
|
rm -f $name
|
||||||
gcc -O2 -D_FILE_OFFSET_BITS=64 vtoy_fuse_iso.c -o $name $LIBFUSE_DIR/lib/libfuse.a -lpthread -ldl $opt
|
gcc -static -O2 -D_FILE_OFFSET_BITS=64 vtoy_fuse_iso.c -o $name $LIBFUSE_DIR/lib/libfuse.a -lpthread -ldl $opt
|
||||||
|
|
||||||
if [ -e $name ]; then
|
if [ -e $name ]; then
|
||||||
echo -e "\n############### SUCCESS $name ##################\n"
|
echo -e "\n############### SUCCESS $name ##################\n"
|
||||||
|
@ -1197,6 +1197,7 @@ static cmd_para ventoy_cmds[] =
|
|||||||
{ "vt_linux_clear_initrd", ventoy_cmd_clear_initrd_list, 0, NULL, "", "", NULL },
|
{ "vt_linux_clear_initrd", ventoy_cmd_clear_initrd_list, 0, NULL, "", "", NULL },
|
||||||
{ "vt_linux_dump_initrd", ventoy_cmd_dump_initrd_list, 0, NULL, "", "", NULL },
|
{ "vt_linux_dump_initrd", ventoy_cmd_dump_initrd_list, 0, NULL, "", "", NULL },
|
||||||
{ "vt_linux_initrd_count", ventoy_cmd_initrd_count, 0, NULL, "", "", NULL },
|
{ "vt_linux_initrd_count", ventoy_cmd_initrd_count, 0, NULL, "", "", NULL },
|
||||||
|
{ "vt_linux_valid_initrd_count", ventoy_cmd_valid_initrd_count, 0, NULL, "", "", NULL },
|
||||||
{ "vt_linux_locate_initrd", ventoy_cmd_linux_locate_initrd, 0, NULL, "", "", NULL },
|
{ "vt_linux_locate_initrd", ventoy_cmd_linux_locate_initrd, 0, NULL, "", "", NULL },
|
||||||
{ "vt_linux_chain_data", ventoy_cmd_linux_chain_data, 0, NULL, "", "", NULL },
|
{ "vt_linux_chain_data", ventoy_cmd_linux_chain_data, 0, NULL, "", "", NULL },
|
||||||
|
|
||||||
|
@ -398,6 +398,7 @@ int ventoy_has_efi_eltorito(grub_file_t file, grub_uint32_t sector);
|
|||||||
grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
|
grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||||
grub_err_t ventoy_cmd_linux_locate_initrd(grub_extcmd_context_t ctxt, int argc, char **args);
|
grub_err_t ventoy_cmd_linux_locate_initrd(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||||
grub_err_t ventoy_cmd_initrd_count(grub_extcmd_context_t ctxt, int argc, char **args);
|
grub_err_t ventoy_cmd_initrd_count(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||||
|
grub_err_t ventoy_cmd_valid_initrd_count(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||||
grub_err_t ventoy_cmd_load_cpio(grub_extcmd_context_t ctxt, int argc, char **args);
|
grub_err_t ventoy_cmd_load_cpio(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||||
int ventoy_cpio_newc_fill_head(void *buf, int filesize, void *filedata, const char *name);
|
int ventoy_cpio_newc_fill_head(void *buf, int filesize, void *filedata, const char *name);
|
||||||
grub_file_t ventoy_grub_file_open(enum grub_file_type type, const char *fmt, ...);
|
grub_file_t ventoy_grub_file_open(enum grub_file_type type, const char *fmt, ...);
|
||||||
|
@ -543,6 +543,7 @@ grub_err_t ventoy_cmd_specify_initrd_file(grub_extcmd_context_t ctxt, int argc,
|
|||||||
grub_strncpy(img->name, args[0], sizeof(img->name));
|
grub_strncpy(img->name, args[0], sizeof(img->name));
|
||||||
if (ventoy_find_initrd_by_name(g_initrd_img_list, img->name))
|
if (ventoy_find_initrd_by_name(g_initrd_img_list, img->name))
|
||||||
{
|
{
|
||||||
|
debug("%s is already exist\n", args[0]);
|
||||||
grub_free(img);
|
grub_free(img);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -738,6 +739,23 @@ grub_err_t ventoy_cmd_initrd_count(grub_extcmd_context_t ctxt, int argc, char **
|
|||||||
(void)argc;
|
(void)argc;
|
||||||
(void)args;
|
(void)args;
|
||||||
|
|
||||||
|
if (argc == 1)
|
||||||
|
{
|
||||||
|
grub_snprintf(buf, sizeof(buf), "%d", g_initrd_img_count);
|
||||||
|
grub_env_set(args[0], buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_err_t ventoy_cmd_valid_initrd_count(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
|
{
|
||||||
|
char buf[32] = {0};
|
||||||
|
|
||||||
|
(void)ctxt;
|
||||||
|
(void)argc;
|
||||||
|
(void)args;
|
||||||
|
|
||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
{
|
{
|
||||||
grub_snprintf(buf, sizeof(buf), "%d", g_valid_initrd_count);
|
grub_snprintf(buf, sizeof(buf), "%d", g_valid_initrd_count);
|
||||||
@ -750,6 +768,7 @@ grub_err_t ventoy_cmd_initrd_count(grub_extcmd_context_t ctxt, int argc, char **
|
|||||||
static grub_err_t ventoy_linux_locate_initrd(int filt, int *filtcnt)
|
static grub_err_t ventoy_linux_locate_initrd(int filt, int *filtcnt)
|
||||||
{
|
{
|
||||||
int data;
|
int data;
|
||||||
|
int filtbysize = 1;
|
||||||
int sizefilt = 0;
|
int sizefilt = 0;
|
||||||
grub_file_t file;
|
grub_file_t file;
|
||||||
initrd_info *node;
|
initrd_info *node;
|
||||||
@ -757,6 +776,11 @@ static grub_err_t ventoy_linux_locate_initrd(int filt, int *filtcnt)
|
|||||||
debug("ventoy_linux_locate_initrd %d\n", filt);
|
debug("ventoy_linux_locate_initrd %d\n", filt);
|
||||||
|
|
||||||
g_valid_initrd_count = 0;
|
g_valid_initrd_count = 0;
|
||||||
|
|
||||||
|
if (grub_env_get("INITRD_NO_SIZE_FILT"))
|
||||||
|
{
|
||||||
|
filtbysize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (node = g_initrd_img_list; node; node = node->next)
|
for (node = g_initrd_img_list; node; node = node->next)
|
||||||
{
|
{
|
||||||
@ -769,12 +793,18 @@ static grub_err_t ventoy_linux_locate_initrd(int filt, int *filtcnt)
|
|||||||
debug("file <%s> size:%d\n", node->name, (int)file->size);
|
debug("file <%s> size:%d\n", node->name, (int)file->size);
|
||||||
|
|
||||||
/* initrd file too small */
|
/* initrd file too small */
|
||||||
if (filt > 0 && file->size <= g_ventoy_cpio_size + 2048)
|
if (filtbysize
|
||||||
|
&& (NULL == grub_strstr(node->name, "minirt.gz"))
|
||||||
|
&& (NULL == grub_strstr(node->name, "initrd.xz"))
|
||||||
|
)
|
||||||
{
|
{
|
||||||
debug("file size too small %d\n", (int)g_ventoy_cpio_size);
|
if (filt > 0 && file->size <= g_ventoy_cpio_size + 2048)
|
||||||
grub_file_close(file);
|
{
|
||||||
sizefilt++;
|
debug("file size too small %d\n", (int)g_ventoy_cpio_size);
|
||||||
continue;
|
grub_file_close(file);
|
||||||
|
sizefilt++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grub_strcmp(file->fs->name, "iso9660") == 0)
|
if (grub_strcmp(file->fs->name, "iso9660") == 0)
|
||||||
|
@ -97,6 +97,9 @@ ventoy_os_install_dmsetup() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wait_for_usb_disk_ready
|
||||||
|
|
||||||
vtdiskname=$(get_ventoy_disk_name)
|
vtdiskname=$(get_ventoy_disk_name)
|
||||||
if [ "$vtdiskname" = "unknown" ]; then
|
if [ "$vtdiskname" = "unknown" ]; then
|
||||||
vtlog "ventoy disk not found"
|
vtlog "ventoy disk not found"
|
||||||
|
@ -21,11 +21,36 @@
|
|||||||
|
|
||||||
DISTRO='default'
|
DISTRO='default'
|
||||||
|
|
||||||
if [ -e /etc/initrd-release ]; then
|
if [ -d /KNOPPIX ]; then
|
||||||
|
DISTRO='knoppix'
|
||||||
|
elif [ -e /etc/initrd-release ]; then
|
||||||
if $EGREP -q "ID=.*antix|ID=.*mx" /etc/initrd-release; then
|
if $EGREP -q "ID=.*antix|ID=.*mx" /etc/initrd-release; then
|
||||||
DISTRO='antix'
|
DISTRO='antix'
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -e /init ]; then
|
||||||
|
if $GREP -q PUPPYSFS /init; then
|
||||||
|
if $GREP -q VEKETSFS /init; then
|
||||||
|
DISTRO='veket'
|
||||||
|
else
|
||||||
|
DISTRO='puppy'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e /etc/os-release ]; then
|
||||||
|
if $GREP -q 'Tails' /etc/os-release; then
|
||||||
|
DISTRO='tails'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$DISTRO"="default" ]; then
|
||||||
|
if $GREP -q 'slax/' /proc/cmdline; then
|
||||||
|
DISTRO='slax'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo "##### distribution = $DISTRO ######" >> $VTLOG
|
echo "##### distribution = $DISTRO ######" >> $VTLOG
|
||||||
. $VTOY_PATH/hook/debian/${DISTRO}-hook.sh
|
. $VTOY_PATH/hook/debian/${DISTRO}-hook.sh
|
||||||
|
@ -23,5 +23,9 @@ if [ -d /etc/udev/rules.d ]; then
|
|||||||
ventoy_systemd_udevd_work_around
|
ventoy_systemd_udevd_work_around
|
||||||
ventoy_add_udev_rule "$VTOY_PATH/hook/default/udev_disk_hook.sh %k noreplace"
|
ventoy_add_udev_rule "$VTOY_PATH/hook/default/udev_disk_hook.sh %k noreplace"
|
||||||
else
|
else
|
||||||
$SED "/mdev *-s/a\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/gentoo/disk_hook.sh" -i /init
|
if $GREP -q kaspersky /proc/version; then
|
||||||
|
$SED "/sysresccd_stage1_normal[^(]*$/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/gentoo/disk_hook.sh" -i /init
|
||||||
|
else
|
||||||
|
$SED "/mdev *-s/a\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/gentoo/disk_hook.sh" -i /init
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -29,7 +29,7 @@ SED=$BUSYBOX_PATH/sed
|
|||||||
SLEEP=$BUSYBOX_PATH/sleep
|
SLEEP=$BUSYBOX_PATH/sleep
|
||||||
HEAD=$BUSYBOX_PATH/head
|
HEAD=$BUSYBOX_PATH/head
|
||||||
VTOY_DM_PATH=/dev/mapper/ventoy
|
VTOY_DM_PATH=/dev/mapper/ventoy
|
||||||
VTOY_DEBUG_LEVEL=$($BUSYBOX_PATH/hexdump -n 1 -s 430 -e '1/1 "%02x"' $VTOY_PATH/ventoy_os_param)
|
VTOY_DEBUG_LEVEL=$($BUSYBOX_PATH/hexdump -n 1 -s 450 -e '1/1 "%02x"' $VTOY_PATH/ventoy_os_param)
|
||||||
|
|
||||||
if [ "$VTOY_DEBUG_LEVEL" = "01" ]; then
|
if [ "$VTOY_DEBUG_LEVEL" = "01" ]; then
|
||||||
if [ -e /dev/console ]; then
|
if [ -e /dev/console ]; then
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
# Step 1 : parse kernel debug parameter #
|
# Step 1 : parse kernel debug parameter #
|
||||||
# #
|
# #
|
||||||
####################################################################
|
####################################################################
|
||||||
mkdir /proc; mount -t proc proc /proc
|
[ -d /proc ] || mkdir /proc; mount -t proc proc /proc
|
||||||
vtcmdline=$(cat /proc/cmdline)
|
vtcmdline=$(cat /proc/cmdline)
|
||||||
vtkerver=$(cat /proc/version)
|
vtkerver=$(cat /proc/version)
|
||||||
umount /proc; rm -rf /proc
|
umount /proc; rm -rf /proc
|
||||||
@ -71,9 +71,9 @@ ventoy_unpack_initramfs() {
|
|||||||
if [ "${vtx:0:4}" = "${vtmagic:0:4}" ]; then
|
if [ "${vtx:0:4}" = "${vtmagic:0:4}" ]; then
|
||||||
echo "vtx=$vtx" >> $VTLOG
|
echo "vtx=$vtx" >> $VTLOG
|
||||||
if [ $vtskip -eq 0 ]; then
|
if [ $vtskip -eq 0 ]; then
|
||||||
${vtx:5} $vtfile | (cpio -idm 2>>$VTLOG; cat > $vttmp)
|
${vtx:5} $vtfile | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
|
||||||
else
|
else
|
||||||
dd if=$vtfile skip=$vtskip iflag=skip_bytes status=none | ${vtx:5} | (cpio -idm 2>>$VTLOG; cat > $vttmp)
|
dd if=$vtfile skip=$vtskip iflag=skip_bytes status=none | ${vtx:5} | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
|
||||||
fi
|
fi
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
@ -98,36 +98,57 @@ ventoy_unpack_initrd() {
|
|||||||
# This export is for busybox cpio command
|
# This export is for busybox cpio command
|
||||||
export EXTRACT_UNSAFE_SYMLINKS=1
|
export EXTRACT_UNSAFE_SYMLINKS=1
|
||||||
|
|
||||||
for vtfile in $(ls /initrd*); do
|
# special process
|
||||||
#decompress first initrd
|
need_xzminidec() {
|
||||||
vtmagic=$(hexdump -n 2 -e '2/1 "%02X"' $vtfile)
|
testmagic=$(hexdump -n 2 -e '2/1 "%02X"' /initrd001)
|
||||||
|
if [ "FD37" = "${testmagic:0:4}" ]; then
|
||||||
if ventoy_is_initrd_ramdisk; then
|
if echo $vtkerver | grep -q 'kaspersky'; then
|
||||||
ventoy_unpack_initrd $vtfile $vtmagic ${vtfile}_tmp
|
true
|
||||||
mv ${vtfile}_tmp $vtfile
|
elif echo $vtkerver | grep -q 'kiosk.*Gentoo'; then
|
||||||
break
|
true
|
||||||
else
|
else
|
||||||
ventoy_unpack_initramfs $vtfile 0 $vtmagic ${vtfile}_tmp
|
false
|
||||||
fi
|
|
||||||
|
|
||||||
#only for cpio,cpio,...,initrd sequence, initrd,cpio or initrd,initrd sequence is not supported
|
|
||||||
while [ -e ${vtfile}_tmp ] && [ $(stat -c '%s' ${vtfile}_tmp) -gt 512 ]; do
|
|
||||||
mv ${vtfile}_tmp $vtfile
|
|
||||||
vtdump=$(hexdump -n 512 -e '512/1 "%02X"' $vtfile)
|
|
||||||
vtmagic=$(echo $vtdump | sed 's/^\(00\)*//')
|
|
||||||
let vtoffset="(${#vtdump}-${#vtmagic})/2"
|
|
||||||
|
|
||||||
if [ -z "$vtmagic" ]; then
|
|
||||||
echo "terminate with all zero data file" >> $VTLOG
|
|
||||||
break
|
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
ventoy_unpack_initramfs $vtfile $vtoffset ${vtmagic:0:4} ${vtfile}_tmp
|
false
|
||||||
done
|
fi
|
||||||
|
}
|
||||||
rm -f $vtfile ${vtfile}_tmp
|
|
||||||
done
|
|
||||||
|
|
||||||
|
if need_xzminidec; then
|
||||||
|
echo "use xzminidec" >> $VTLOG
|
||||||
|
cat /initrd001 | xzminidec | cpio -idmu 2>>$VTLOG
|
||||||
|
rm -f /initrd001
|
||||||
|
else
|
||||||
|
for vtfile in $(ls /initrd*); do
|
||||||
|
#decompress first initrd
|
||||||
|
vtmagic=$(hexdump -n 2 -e '2/1 "%02X"' $vtfile)
|
||||||
|
|
||||||
|
if ventoy_is_initrd_ramdisk; then
|
||||||
|
ventoy_unpack_initrd $vtfile $vtmagic ${vtfile}_tmp
|
||||||
|
mv ${vtfile}_tmp $vtfile
|
||||||
|
break
|
||||||
|
else
|
||||||
|
ventoy_unpack_initramfs $vtfile 0 $vtmagic ${vtfile}_tmp
|
||||||
|
fi
|
||||||
|
|
||||||
|
#only for cpio,cpio,...,initrd sequence, initrd,cpio or initrd,initrd sequence is not supported
|
||||||
|
while [ -e ${vtfile}_tmp ] && [ $(stat -c '%s' ${vtfile}_tmp) -gt 512 ]; do
|
||||||
|
mv ${vtfile}_tmp $vtfile
|
||||||
|
vtdump=$(hexdump -n 512 -e '512/1 "%02X"' $vtfile)
|
||||||
|
vtmagic=$(echo $vtdump | sed 's/^\(00\)*//')
|
||||||
|
let vtoffset="(${#vtdump}-${#vtmagic})/2"
|
||||||
|
|
||||||
|
if [ -z "$vtmagic" ]; then
|
||||||
|
echo "terminate with all zero data file" >> $VTLOG
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
ventoy_unpack_initramfs $vtfile $vtoffset ${vtmagic:0:4} ${vtfile}_tmp
|
||||||
|
done
|
||||||
|
|
||||||
|
rm -f $vtfile ${vtfile}_tmp
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
#break here for debug
|
#break here for debug
|
||||||
if [ "$VTOY_BREAK_LEVEL" = "02" ] || [ "$VTOY_BREAK_LEVEL" = "12" ]; then
|
if [ "$VTOY_BREAK_LEVEL" = "02" ] || [ "$VTOY_BREAK_LEVEL" = "12" ]; then
|
||||||
|
@ -142,6 +142,12 @@ ventoy_get_os_type() {
|
|||||||
echo 'slackware'; return
|
echo 'slackware'; return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -e /init ]; then
|
||||||
|
if $GREP -i -q zeroshell /init; then
|
||||||
|
echo 'zeroshell'; return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo "default"
|
echo "default"
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -30,7 +30,7 @@ function get_os_type {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function locate_initrd {
|
function locate_initrd {
|
||||||
vt_linux_locate_initrd
|
vt_linux_locate_initrd
|
||||||
|
|
||||||
if [ -n "${vtdebug_flag}" ]; then
|
if [ -n "${vtdebug_flag}" ]; then
|
||||||
@ -64,6 +64,16 @@ function distro_specify_initrd_file {
|
|||||||
if [ -e (loop)/casper/initrd-oem ]; then
|
if [ -e (loop)/casper/initrd-oem ]; then
|
||||||
vt_linux_specify_initrd_file /casper/initrd-oem
|
vt_linux_specify_initrd_file /casper/initrd-oem
|
||||||
fi
|
fi
|
||||||
|
elif [ -e (loop)/boot/grub/initrd.xz ]; then
|
||||||
|
vt_linux_specify_initrd_file /boot/grub/initrd.xz
|
||||||
|
elif [ -e (loop)/initrd.gz ]; then
|
||||||
|
vt_linux_specify_initrd_file /initrd.gz
|
||||||
|
elif [ -e (loop)/slax/boot/initrfs.img ]; then
|
||||||
|
vt_linux_specify_initrd_file /slax/boot/initrfs.img
|
||||||
|
elif [ -e (loop)/pmagic/initrd.img ]; then
|
||||||
|
vt_linux_specify_initrd_file /pmagic/initrd.img
|
||||||
|
elif [ -e (loop)/boot/initrd.xz ]; then
|
||||||
|
vt_linux_specify_initrd_file /boot/initrd.xz
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,28 +109,25 @@ function uefi_linux_menu_func {
|
|||||||
|
|
||||||
vt_linux_clear_initrd
|
vt_linux_clear_initrd
|
||||||
|
|
||||||
for file in "boot/grub/grub.cfg" "EFI/BOOT/grub.cfg" "EFI/boot/grub.cfg" "efi/boot/grub.cfg" "EFI/BOOT/BOOTX64.conf"; do
|
if [ -d (loop)/pmagic ]; then
|
||||||
if [ -e (loop)/$file ]; then
|
vt_linux_specify_initrd_file /pmagic/initrd.img
|
||||||
vt_linux_parse_initrd_grub file (loop)/$file
|
else
|
||||||
fi
|
for file in "boot/grub/grub.cfg" "EFI/BOOT/grub.cfg" "EFI/boot/grub.cfg" "efi/boot/grub.cfg" "EFI/BOOT/BOOTX64.conf"; do
|
||||||
done
|
if [ -e (loop)/$file ]; then
|
||||||
|
vt_linux_parse_initrd_grub file (loop)/$file
|
||||||
vt_linux_initrd_count initrd_count
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# special process for special distros
|
# special process for special distros
|
||||||
if vt_cmp $initrd_count eq 0; then
|
if [ -d (loop)/loader/entries ]; then
|
||||||
if [ -d (loop)/loader/entries ]; then
|
set LoadIsoEfiDriver=on
|
||||||
set LoadIsoEfiDriver=on
|
vt_linux_parse_initrd_grub dir (loop)/loader/entries/
|
||||||
vt_linux_parse_initrd_grub dir (loop)/loader/entries/
|
elif [ -d (loop)/boot/grub ]; then
|
||||||
elif [ -d (loop)/boot/grub ]; then
|
vt_linux_parse_initrd_grub dir (loop)/boot/grub/
|
||||||
vt_linux_parse_initrd_grub dir (loop)/boot/grub/
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
vt_linux_initrd_count initrd_count
|
distro_specify_initrd_file
|
||||||
if vt_cmp $initrd_count eq 0; then
|
|
||||||
distro_specify_initrd_file
|
|
||||||
fi
|
|
||||||
|
|
||||||
locate_initrd
|
locate_initrd
|
||||||
fi
|
fi
|
||||||
@ -237,36 +244,33 @@ function legacy_linux_menu_func {
|
|||||||
vt_load_cpio $vtoy_path/ventoy.cpio
|
vt_load_cpio $vtoy_path/ventoy.cpio
|
||||||
|
|
||||||
vt_linux_clear_initrd
|
vt_linux_clear_initrd
|
||||||
|
|
||||||
for dir in "isolinux" "boot/isolinux" "boot/x86_64/loader" "syslinux" "boot/syslinux"; do
|
|
||||||
if [ -d (loop)/$dir ]; then
|
|
||||||
vt_linux_parse_initrd_isolinux (loop)/$dir/
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
vt_linux_initrd_count initrd_count
|
if [ -d (loop)/pmagic ]; then
|
||||||
|
vt_linux_specify_initrd_file /pmagic/initrd.img
|
||||||
|
else
|
||||||
|
for dir in "isolinux" "boot/isolinux" "boot/x86_64/loader" "syslinux" "boot/syslinux"; do
|
||||||
|
if [ -d (loop)/$dir ]; then
|
||||||
|
vt_linux_parse_initrd_isolinux (loop)/$dir/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# special process for special distros
|
# special process for special distros
|
||||||
if vt_cmp $initrd_count eq 0; then
|
#archlinux
|
||||||
#archlinux
|
if [ -d (loop)/arch/boot/syslinux ]; then
|
||||||
if [ -d (loop)/arch/boot/syslinux ]; then
|
vt_linux_parse_initrd_isolinux (loop)/arch/boot/syslinux/ /arch/
|
||||||
vt_linux_parse_initrd_isolinux (loop)/arch/boot/syslinux/ /arch/
|
vt_linux_parse_initrd_isolinux (loop)/arch/boot/syslinux/ /arch/boot/syslinux/
|
||||||
vt_linux_parse_initrd_isolinux (loop)/arch/boot/syslinux/ /arch/boot/syslinux/
|
|
||||||
|
#manjaro
|
||||||
#manjaro
|
elif [ -d (loop)/manjaro ]; then
|
||||||
elif [ -d (loop)/manjaro ]; then
|
if [ -e (loop)/boot/grub/kernels.cfg ]; then
|
||||||
if [ -e (loop)/boot/grub/kernels.cfg ]; then
|
vt_linux_parse_initrd_grub file (loop)/boot/grub/kernels.cfg
|
||||||
vt_linux_parse_initrd_grub file (loop)/boot/grub/kernels.cfg
|
|
||||||
fi
|
|
||||||
elif [ -e (loop)/boot/grub/grub.cfg ]; then
|
|
||||||
vt_linux_parse_initrd_grub file (loop)/boot/grub/grub.cfg
|
|
||||||
fi
|
fi
|
||||||
|
elif [ -e (loop)/boot/grub/grub.cfg ]; then
|
||||||
|
vt_linux_parse_initrd_grub file (loop)/boot/grub/grub.cfg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
vt_linux_initrd_count initrd_count
|
distro_specify_initrd_file
|
||||||
if vt_cmp $initrd_count eq 0; then
|
|
||||||
distro_specify_initrd_file
|
|
||||||
fi
|
|
||||||
|
|
||||||
locate_initrd
|
locate_initrd
|
||||||
fi
|
fi
|
||||||
@ -344,7 +348,7 @@ function legacy_iso_memdisk {
|
|||||||
#############################################################
|
#############################################################
|
||||||
#############################################################
|
#############################################################
|
||||||
|
|
||||||
set VENTOY_VERSION="1.0.04"
|
set VENTOY_VERSION="1.0.05"
|
||||||
|
|
||||||
#disable timeout
|
#disable timeout
|
||||||
unset timeout
|
unset timeout
|
||||||
@ -358,7 +362,7 @@ vt_device $root vtoy_dev
|
|||||||
if [ "$vtoy_dev" = "tftp" ]; then
|
if [ "$vtoy_dev" = "tftp" ]; then
|
||||||
set vtoy_path=($root)
|
set vtoy_path=($root)
|
||||||
for vtid in 0 1 2 3; do
|
for vtid in 0 1 2 3; do
|
||||||
if [ -d (hd$vtid,2)/grub ]; then
|
if [ -d (hd$vtid,2)/ventoy ]; then
|
||||||
set iso_path=(hd$vtid,1)
|
set iso_path=(hd$vtid,1)
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -28,6 +28,7 @@
|
|||||||
#include "vtoyjump.h"
|
#include "vtoyjump.h"
|
||||||
#include "fat_filelib.h"
|
#include "fat_filelib.h"
|
||||||
|
|
||||||
|
static ventoy_os_param g_os_param;
|
||||||
static UINT8 g_os_param_reserved[32];
|
static UINT8 g_os_param_reserved[32];
|
||||||
static BOOL g_64bit_system = FALSE;
|
static BOOL g_64bit_system = FALSE;
|
||||||
static ventoy_guid g_ventoy_guid = VENTOY_GUID;
|
static ventoy_guid g_ventoy_guid = VENTOY_GUID;
|
||||||
@ -784,7 +785,6 @@ int VentoyJump(INT argc, CHAR **argv, CHAR *LunchFile)
|
|||||||
DWORD PeStart;
|
DWORD PeStart;
|
||||||
DWORD FileSize;
|
DWORD FileSize;
|
||||||
BYTE *Buffer = NULL;
|
BYTE *Buffer = NULL;
|
||||||
ventoy_os_param os_param;
|
|
||||||
CHAR ExeFileName[MAX_PATH];
|
CHAR ExeFileName[MAX_PATH];
|
||||||
|
|
||||||
sprintf_s(ExeFileName, sizeof(ExeFileName), "%s", argv[0]);
|
sprintf_s(ExeFileName, sizeof(ExeFileName), "%s", argv[0]);
|
||||||
@ -818,9 +818,9 @@ int VentoyJump(INT argc, CHAR **argv, CHAR *LunchFile)
|
|||||||
CheckPeHead(Buffer + PeStart + sizeof(ventoy_os_param)))
|
CheckPeHead(Buffer + PeStart + sizeof(ventoy_os_param)))
|
||||||
{
|
{
|
||||||
Log("Find os pararm at %u", PeStart);
|
Log("Find os pararm at %u", PeStart);
|
||||||
memcpy(&os_param, Buffer + PeStart, sizeof(ventoy_os_param));
|
|
||||||
|
|
||||||
memcpy(g_os_param_reserved, os_param.vtoy_reserved, sizeof(g_os_param_reserved));
|
memcpy(&g_os_param, Buffer + PeStart, sizeof(ventoy_os_param));
|
||||||
|
memcpy(g_os_param_reserved, g_os_param.vtoy_reserved, sizeof(g_os_param_reserved));
|
||||||
|
|
||||||
if (g_os_param_reserved[0] == 1)
|
if (g_os_param_reserved[0] == 1)
|
||||||
{
|
{
|
||||||
@ -829,11 +829,11 @@ int VentoyJump(INT argc, CHAR **argv, CHAR *LunchFile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// convert / to \\
|
// convert / to \\
|
||||||
for (Pos = 0; Pos < sizeof(os_param.vtoy_img_path) && os_param.vtoy_img_path[Pos]; Pos++)
|
for (Pos = 0; Pos < sizeof(g_os_param.vtoy_img_path) && g_os_param.vtoy_img_path[Pos]; Pos++)
|
||||||
{
|
{
|
||||||
if (os_param.vtoy_img_path[Pos] == '/')
|
if (g_os_param.vtoy_img_path[Pos] == '/')
|
||||||
{
|
{
|
||||||
os_param.vtoy_img_path[Pos] = '\\';
|
g_os_param.vtoy_img_path[Pos] = '\\';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -857,7 +857,7 @@ int VentoyJump(INT argc, CHAR **argv, CHAR *LunchFile)
|
|||||||
goto End;
|
goto End;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = VentoyHook(&os_param);
|
rc = VentoyHook(&g_os_param);
|
||||||
|
|
||||||
End:
|
End:
|
||||||
|
|
||||||
@ -912,35 +912,31 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
GetStartupInfoA(&Si);
|
GetStartupInfoA(&Si);
|
||||||
|
|
||||||
for (i = 0; i < 10; i++)
|
memset(LunchFile, 0, sizeof(LunchFile));
|
||||||
|
rc = VentoyJump(argc, argv, LunchFile);
|
||||||
|
|
||||||
|
if (g_os_param_reserved[0] == 3)
|
||||||
{
|
{
|
||||||
Log("VentoyJump loop %d", i + 1);
|
Log("Open log for debug ...");
|
||||||
|
sprintf_s(LunchFile, sizeof(LunchFile), "%s", "notepad.exe ventoy.log");
|
||||||
memset(LunchFile, 0, sizeof(LunchFile));
|
}
|
||||||
rc = VentoyJump(argc, argv, LunchFile);
|
else
|
||||||
|
{
|
||||||
if (g_os_param_reserved[0] == 3)
|
Si.dwFlags |= STARTF_USESHOWWINDOW;
|
||||||
{
|
Si.wShowWindow = SW_HIDE;
|
||||||
Log("Open log for debug ...");
|
Log("Ventoy jump %s ...", rc == 0 ? "success" : "failed");
|
||||||
sprintf_s(LunchFile, sizeof(LunchFile), "%s", "notepad.exe ventoy.log");
|
}
|
||||||
break;
|
|
||||||
}
|
CreateProcessA(NULL, LunchFile, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);
|
||||||
else if (rc == 0)
|
|
||||||
{
|
while (rc)
|
||||||
Log("Ventoy jump success ...");
|
{
|
||||||
Si.dwFlags |= STARTF_USESHOWWINDOW;
|
Log("Ventoy hook failed, now wait and retry ...");
|
||||||
Si.wShowWindow = SW_HIDE;
|
Sleep(1000);
|
||||||
break;
|
|
||||||
}
|
rc = VentoyHook(&g_os_param);
|
||||||
else
|
|
||||||
{
|
|
||||||
Log("Ventoy jump fail, now wait ...");
|
|
||||||
sprintf_s(LunchFile, sizeof(LunchFile), "%s", "cmd.exe");
|
|
||||||
Sleep(3000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateProcessA(NULL, LunchFile, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);
|
|
||||||
WaitForSingleObject(Pi.hProcess, INFINITE);
|
WaitForSingleObject(Pi.hProcess, INFINITE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user