Commit d5b829f8 authored by longpanda's avatar longpanda
Browse files

1.0.07 release

parent d551fc2e
#!/bin/sh
OLDDIR=$PWD
if ! [ -f ./tool/ventoy_lib.sh ]; then
cd ${0%Ventoy2Disk.sh}
fi
. ./tool/ventoy_lib.sh
print_usage() {
......@@ -18,12 +24,7 @@ echo '* longpanda admin@ventoy.net *'
echo '***********************************************************'
echo ''
vtdebug "############# Ventoy2Disk ################"
if ! [ -e ventoy/version ]; then
vterr "Please run under the correct directory!"
exit 1
fi
vtdebug "############# Ventoy2Disk $0 ################"
if [ "$1" = "-i" ]; then
MODE="install"
......@@ -34,11 +35,13 @@ elif [ "$1" = "-u" ]; then
MODE="update"
else
print_usage
cd $OLDDIR
exit 1
fi
if ! [ -b "$2" ]; then
print_usage
cd $OLDDIR
exit 1
fi
......@@ -46,6 +49,7 @@ if [ -z "$SUDO_USER" ]; then
if [ "$USER" != "root" ]; then
vterr "EUID is $EUID root permission is required."
echo ''
cd $OLDDIR
exit 1
fi
fi
......@@ -67,6 +71,7 @@ cd ../
if ! check_tool_work_ok; then
vterr "Some tools can not run in current system. Please check log.txt for detail."
cd $OLDDIR
exit 1
fi
......@@ -75,17 +80,26 @@ DISK=$2
if ! [ -b "$DISK" ]; then
vterr "Disk $DISK does not exist"
cd $OLDDIR
exit 1
fi
if [ -e /sys/class/block/${DISK#/dev/}/start ]; then
vterr "$DISK is a partition, please use the whole disk"
cd $OLDDIR
exit 1
fi
grep "^$DISK" /proc/mounts | while read mtline; do
mtpnt=$(echo $mtline | awk '{print $2}')
vtdebug "Trying to umount $mtpnt ..."
umount $mtpnt >/dev/null 2>&1
done
if grep "$DISK" /proc/mounts; then
vterr "$DISK is already mounted, please umount it first!"
cd $OLDDIR
exit 1
fi
......@@ -95,6 +109,7 @@ if [ "$MODE" = "install" ]; then
if ! fdisk -v >/dev/null 2>&1; then
vterr "fdisk is needed by ventoy installation, but is not found in the system."
cd $OLDDIR
exit 1
fi
......@@ -105,6 +120,7 @@ if [ "$MODE" = "install" ]; then
vtwarn "Use -u option to do a safe upgrade operation."
vtwarn "OR if you really want to reinstall ventoy to $DISK, please use -I option."
vtwarn ""
cd $OLDDIR
exit 1
fi
fi
......@@ -114,6 +130,7 @@ if [ "$MODE" = "install" ]; then
if [ $disk_sector_num -gt 4294967296 ]; then
vterr "$DISK is over 2TB size, MBR will not work on it."
cd $OLDDIR
exit 1
fi
......@@ -150,7 +167,7 @@ if [ "$MODE" = "install" ]; then
exit 1
fi
if ! dd if=/dev/zero of=$DISK bs=1 count=512 status=none; then
if ! dd if=/dev/zero of=$DISK bs=1 count=512 status=none conv=fsync; then
vterr "Write data to $DISK failed, please check whether it's in use."
exit 1
fi
......@@ -178,15 +195,15 @@ if [ "$MODE" = "install" ]; then
chmod +x ./tool/vtoy_gen_uuid
dd status=none if=./boot/boot.img of=$DISK bs=1 count=446
./tool/xzcat ./boot/core.img.xz | dd status=none of=$DISK bs=512 count=2047 seek=1
./tool/xzcat ./ventoy/ventoy.disk.img.xz | dd status=none of=$DISK bs=512 count=$VENTOY_SECTOR_NUM seek=$part2_start_sector
dd status=none conv=fsync if=./boot/boot.img of=$DISK bs=1 count=446
./tool/xzcat ./boot/core.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=2047 seek=1
./tool/xzcat ./ventoy/ventoy.disk.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=$VENTOY_SECTOR_NUM seek=$part2_start_sector
#disk uuid
./tool/vtoy_gen_uuid | dd status=none of=${DISK} seek=384 bs=1 count=16
./tool/vtoy_gen_uuid | dd status=none conv=fsync of=${DISK} seek=384 bs=1 count=16
#disk signature
./tool/vtoy_gen_uuid | dd status=none of=${DISK} skip=12 seek=440 bs=1 count=4
./tool/vtoy_gen_uuid | dd status=none conv=fsync of=${DISK} skip=12 seek=440 bs=1 count=4
sync
......@@ -203,6 +220,7 @@ else
echo ""
vtwarn "Please use -i option if you want to install ventoy to $DISK"
echo ""
cd $OLDDIR
exit 1
fi
......@@ -214,19 +232,20 @@ else
read -p "Update Ventoy $oldver ===> $curver Continue? (y/n)" Answer
if [ "$Answer" != "y" ]; then
if [ "$Answer" != "Y" ]; then
cd $OLDDIR
exit 0
fi
fi
PART2=$(get_disk_part_name $DISK 2)
dd status=none if=./boot/boot.img of=$DISK bs=1 count=440
dd status=none conv=fsync if=./boot/boot.img of=$DISK bs=1 count=440
./tool/xzcat ./boot/core.img.xz | dd status=none of=$DISK bs=512 count=2047 seek=1
./tool/xzcat ./boot/core.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=2047 seek=1
disk_sector_num=$(cat /sys/block/${DISK#/dev/}/size)
part2_start=$(expr $disk_sector_num - $VENTOY_SECTOR_NUM)
./tool/xzcat ./ventoy/ventoy.disk.img.xz | dd status=none of=$DISK bs=512 count=$VENTOY_SECTOR_NUM seek=$part2_start
./tool/xzcat ./ventoy/ventoy.disk.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=$VENTOY_SECTOR_NUM seek=$part2_start
sync
......@@ -236,3 +255,5 @@ else
fi
cd $OLDDIR
......@@ -76,7 +76,18 @@ function distro_specify_initrd_file {
vt_linux_specify_initrd_file /boot/initrd.xz
elif [ -f (loop)/boot/initrd ]; then
vt_linux_specify_initrd_file /boot/initrd
elif [ -f (loop)/boot/x86_64/loader/initrd ]; then
vt_linux_specify_initrd_file /boot/x86_64/loader/initrd
elif [ -f (loop)/boot/initramfs-x86_64.img ]; then
vt_linux_specify_initrd_file /boot/initramfs-x86_64.img
fi
}
function distro_specify_initrd_file_phase2 {
if [ -f (loop)/boot/initrd.img ]; then
vt_linux_specify_initrd_file /boot/initrd.img
fi
}
......@@ -137,6 +148,17 @@ function uefi_linux_menu_func {
distro_specify_initrd_file
vt_linux_initrd_count vtcount
if [ $vtcount -eq 0 ]; then
distro_specify_initrd_file_phase2
if [ "$vt_efi_dir" = "NO" ]; then
if [ -f (loop)/efi.img ]; then
vt_add_replace_file 0 "initrd"
fi
fi
fi
locate_initrd
fi
......@@ -179,6 +201,14 @@ function uefi_iso_menu_func {
loopback loop ${1}${chosen_path}
get_os_type (loop)
if [ -d (loop)/EFI ]; then
set vt_efi_dir=YES
elif [ -d (loop)/efi ]; then
set vt_efi_dir=YES
else
set vt_efi_dir=NO
fi
if [ -n "$vtcompat" ]; then
set ventoy_compatible=YES
unset vtcompat
......@@ -193,6 +223,8 @@ function uefi_iso_menu_func {
if [ "$vtoy_os" = "Windows" ]; then
if [ "$ventoy_fs_probe" = "iso9660" ]; then
set ventoy_compatible=YES
elif [ -f (loop)/HBCD_PE.ini ]; then
set ventoy_compatible=YES
fi
uefi_windows_menu_func $1
......@@ -279,6 +311,11 @@ function legacy_linux_menu_func {
distro_specify_initrd_file
vt_linux_initrd_count vtcount
if [ $vtcount -eq 0 ]; then
distro_specify_initrd_file_phase2
fi
locate_initrd
fi
......@@ -330,7 +367,10 @@ function legacy_iso_menu_func {
if [ "$vtoy_os" = "Windows" ]; then
if [ "$ventoy_fs_probe" = "iso9660" ]; then
set ventoy_compatible=YES
elif [ -f (loop)/HBCD_PE.ini ]; then
set ventoy_compatible=YES
fi
legacy_windows_menu_func $1
else
legacy_linux_menu_func $1
......@@ -355,7 +395,7 @@ function legacy_iso_memdisk {
#############################################################
#############################################################
set VENTOY_VERSION="1.0.06"
set VENTOY_VERSION="1.0.07"
#disable timeout
unset timeout
......@@ -385,7 +425,11 @@ if [ -f $iso_path/ventoy/ventoy.json ]; then
vt_load_plugin $iso_path
fi
terminal_output gfxterm
if [ -n "$vtoy_gfxmode" ]; then
set gfxmode=$vtoy_gfxmode
else
set gfxmode=1920x1080,1366x768,1024x768
fi
if [ -n "$vtoy_theme" ]; then
set theme=$vtoy_theme
......@@ -393,11 +437,7 @@ else
set theme=$prefix/themes/ventoy/theme.txt
fi
if [ -n "$vtoy_gfxmode" ]; then
set gfxmode=$vtoy_gfxmode
else
set gfxmode=1024x768
fi
terminal_output gfxterm
#colect all image files (iso files)
set ventoy_img_count=0
......
No preview for this file type
......@@ -2,7 +2,7 @@
Ventoy is an open source tool to create bootable USB drive for ISO files.
With ventoy, you don't need to format the disk again and again, you just need to copy the iso file to the USB drive and boot it.
You can copy many iso files at a time and ventoy will give you a boot menu to select them.
Both Legacy BIOS and UEFI are supported in the same way. 160+ ISO files are tested.
Both Legacy BIOS and UEFI are supported in the same way. 200+ ISO files are tested.
A "Ventoy Compatible" concept is introduced by ventoy, which can help to support any ISO file.
See http://www.ventoy.net for detail.
......@@ -13,9 +13,10 @@ See http://www.ventoy.net for detail.
* Fast (limited only by the speed of copying iso file)
* Directly boot from iso file, no extraction needed
* Legacy + UEFI supported in the same way
* UEFI Secure Boot supported (since 1.0.07+) Notes
* ISO files larger than 4GB supported
* Native boot menu style for Legacy & UEFI
* Most type of OS supported, 100+ iso files tested
* Most type of OS supported, 200+ iso files tested
* Not only boot but also complete installation process
* "Ventoy Compatible" concept
* Plugin Framework
......
......@@ -328,6 +328,11 @@ static int vtoy_find_disk_by_size(unsigned long long size, char *diskname)
int rc = 0;
dir = opendir("/sys/block");
if (!dir)
{
return 0;
}
while ((p = readdir(dir)) != NULL)
{
if (!vtoy_is_possible_blkdev(p->d_name))
......@@ -357,6 +362,11 @@ static int vtoy_find_disk_by_guid(uint8_t *guid, char *diskname)
uint8_t vtguid[16];
dir = opendir("/sys/block");
if (!dir)
{
return 0;
}
while ((p = readdir(dir)) != NULL)
{
if (!vtoy_is_possible_blkdev(p->d_name))
......@@ -378,6 +388,12 @@ static int vtoy_find_disk_by_guid(uint8_t *guid, char *diskname)
return count;
}
static int vtoy_printf_iso_path(ventoy_os_param *param)
{
printf("%s\n", param->vtoy_img_path);
return 0;
}
static int vtoy_print_os_param(ventoy_os_param *param, char *diskname)
{
int cnt = 0;
......@@ -458,12 +474,13 @@ int vtoydump_main(int argc, char **argv)
{
int rc;
int ch;
int print_path = 0;
char filename[256] = {0};
char diskname[256] = {0};
char device[64] = {0};
ventoy_os_param *param = NULL;
while ((ch = getopt(argc, argv, "c:f:v::")) != -1)
while ((ch = getopt(argc, argv, "c:f:p:v::")) != -1)
{
if (ch == 'f')
{
......@@ -477,6 +494,11 @@ int vtoydump_main(int argc, char **argv)
{
strncpy(device, optarg, sizeof(device) - 1);
}
else if (ch == 'p')
{
print_path = 1;
strncpy(filename, optarg, sizeof(filename) - 1);
}
else
{
fprintf(stderr, "Usage: %s -f datafile [ -v ] \n", argv[0]);
......@@ -513,7 +535,11 @@ int vtoydump_main(int argc, char **argv)
vtoy_dump_os_param(param);
}
if (device[0])
if (print_path)
{
rc = vtoy_printf_iso_path(param);
}
else if (device[0])
{
rc = vtoy_check_device(param, device);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment