Commit d0edcc0e authored by longpanda's avatar longpanda
Browse files

1.0.09 release

parent c84c0722
......@@ -19,6 +19,17 @@
. $VTOY_PATH/hook/ventoy-os-lib.sh
ventoy_systemd_udevd_work_around
if [ -f $VTOY_PATH/autoinstall ]; then
if [ -f /linuxrc.config ]; then
echo "AutoYaST: file:///ventoy/autoinstall" >> /info-ventoy
$SED "1 iinfo: file:/info-ventoy" -i /linuxrc.config
fi
fi
#echo "Exec: /bin/sh $VTOY_PATH/hook/suse/cdrom-hook.sh" >> /info-ventoy
#echo "install: hd:/?device=/dev/mapper/ventoy" >> /info-ventoy
#$SED "1 iinfo: file:/info-ventoy" -i /linuxrc.config
ventoy_systemd_udevd_work_around
ventoy_add_udev_rule "$VTOY_PATH/hook/suse/udev_disk_hook.sh %k"
......@@ -169,7 +169,20 @@ ventoy_get_os_type() {
echo 'berry'; return
fi
if $GREP -q 'Gobo ' /proc/version; then
echo 'gobo'; return
fi
if $GREP -q 'NuTyX' /proc/version; then
echo 'nutyx'; return
fi
if [ -d /gnu ]; then
vtLineNum=$($FIND /gnu/ -name guix | $BUSYBOX_PATH/wc -l)
if [ $vtLineNum -gt 0 ]; then
echo 'guix'; return
fi
fi
echo "default"
}
......
No preview for this file type
......@@ -110,6 +110,10 @@ function distro_specify_initrd_file_phase2 {
vt_linux_specify_initrd_file /boot/initrd.img
elif [ -f (loop)/Setup/initrd.gz ]; then
vt_linux_specify_initrd_file /Setup/initrd.gz
elif [ -f (loop)/isolinux/initramfs ]; then
vt_linux_specify_initrd_file /isolinux/initramfs
elif [ -f (loop)/boot/iniramfs.igz ]; then
vt_linux_specify_initrd_file /boot/iniramfs.igz
fi
}
......@@ -142,15 +146,15 @@ function uefi_windows_menu_func {
function uefi_linux_menu_func {
if [ "$ventoy_compatible" = "NO" ]; then
vt_load_cpio ${vtoy_path}/ventoy.cpio
vt_load_cpio ${vtoy_path}/ventoy.cpio $2 $1
vt_linux_clear_initrd
if [ -d (loop)/pmagic ]; then
vt_linux_specify_initrd_file /pmagic/initrd.img
else
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 [ -e (loop)/$file ]; then
for file in "boot/grub/grub.cfg" "EFI/BOOT/grub.cfg" "EFI/boot/grub.cfg" "efi/boot/grub.cfg" "EFI/BOOT/BOOTX64.conf" "/grub/grub.cfg"; do
if [ -e (loop)/$file ]; then
vt_linux_parse_initrd_grub file (loop)/$file
fi
done
......@@ -250,9 +254,9 @@ function uefi_iso_menu_func {
set ventoy_compatible=YES
fi
uefi_windows_menu_func $1
uefi_windows_menu_func $1 ${chosen_path}
else
uefi_linux_menu_func $1
uefi_linux_menu_func $1 ${chosen_path}
fi
terminal_output gfxterm
......@@ -300,8 +304,7 @@ function legacy_windows_menu_func {
function legacy_linux_menu_func {
if [ "$ventoy_compatible" = "NO" ]; then
vt_load_cpio $vtoy_path/ventoy.cpio
vt_load_cpio $vtoy_path/ventoy.cpio $2 $1
vt_linux_clear_initrd
......@@ -392,9 +395,9 @@ function legacy_iso_menu_func {
set ventoy_compatible=YES
fi
legacy_windows_menu_func $1
legacy_windows_menu_func $1 ${chosen_path}
else
legacy_linux_menu_func $1
legacy_linux_menu_func $1 ${chosen_path}
fi
}
......@@ -432,7 +435,13 @@ function common_menuentry {
#############################################################
#############################################################
set VENTOY_VERSION="1.0.08"
set VENTOY_VERSION="1.0.09"
# Default menu display mode, you can change it as you want.
# 0: List mode
# 1: TreeView mode
set VTOY_DEFAULT_MENU_MODE=0
#disable timeout
unset timeout
......@@ -442,9 +451,15 @@ set VTOY_ISO_RAW_STR="ISO RAW"
set VTOY_ISO_UEFI_DRV_STR="UEFI FS"
set VTOY_F2_CMD="ventoy_power"
set VTOY_F3_CMD="vt_dynamic_menu tree"
set VTOY_HOTKEY_TIP="F1:Memdisk F2:Power F3:TreeView"
if [ $VTOY_DEFAULT_MENU_MODE -eq 0 ]; then
set VTOY_F3_CMD="vt_dynamic_menu 1 1"
set VTOY_HOTKEY_TIP="F1:Memdisk F2:Power F3:TreeView"
else
set VTOY_F3_CMD="vt_dynamic_menu 1 0"
set VTOY_HOTKEY_TIP="F1:Memdisk F2:Power F3:ListView"
fi
if [ "$grub_platform" = "pc" ]; then
set VTOY_TEXT_MENU_VER="Ventoy $VENTOY_VERSION BIOS www.ventoy.net"
else
......@@ -492,7 +507,11 @@ vt_list_img $iso_path ventoy_img_count
#Main menu
if [ $ventoy_img_count -gt 0 ]; then
vt_dynamic_menu
if [ $VTOY_DEFAULT_MENU_MODE -eq 0 ]; then
vt_dynamic_menu 0 0
else
vt_dynamic_menu 0 1
fi
else
menuentry "No ISO files found (Press enter to reboot ...)" {
echo -e "\n Rebooting ... "
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -22,52 +22,6 @@
#include "Ventoy2Disk.h"
#include "Language.h"
const TCHAR * g_Str_English[STR_ID_MAX] =
{
TEXT("Error"),
TEXT("Warning"),
TEXT("Info"),
TEXT("Please run under the correct directory!"),
TEXT("Device"),
TEXT("Ventoy At Local"),
TEXT("Ventoy In Device"),
TEXT("Status - READY"),
TEXT("Install"),
TEXT("Update"),
TEXT("Upgrade operation is safe, ISO files will be unchanged.\r\nContinue?"),
TEXT("The disk will be formatted and all the data will be lost.\r\nContinue?"),
TEXT("The disk will be formatted and all the data will be lost.\r\nContinue? (Double Check)"),
TEXT("Congratulations!\r\nVentoy has been successfully installed to the device."),
TEXT("An error occurred during the installation. You can replug the USB and try again. Check log.txt for detail."),
TEXT("Congratulations!\r\nVentoy has been successfully updated to the device."),
TEXT("An error occurred during the update. You can replug the USB and try again. Check log.txt for detail."),
TEXT("A thread is running, please wait..."),
};
const TCHAR * g_Str_ChineseSimple[STR_ID_MAX] =
{
TEXT("错误"),
TEXT("警告"),
TEXT("提醒"),
TEXT("请在正确的目录下运行!"),
TEXT("设备"),
TEXT("安装包内 Ventoy 版本"),
TEXT("设备内部 Ventoy 版本"),
TEXT("状态 - 准备就绪"),
TEXT("安装"),
TEXT("升级"),
TEXT("升级操作是安全的, ISO文件不会丢失\r\n是否继续?"),
TEXT("磁盘会被格式化, 所有数据都会丢失!\r\n是否继续?"),
TEXT("磁盘会被格式化, 所有数据都会丢失!\r\n再次确认是否继续?"),
TEXT("恭喜你! Ventoy 已经成功安装到此设备中."),
TEXT("安装 Ventoy 过程中发生错误. 你可以重新拔插一下U盘然后重试一次, 详细信息请查阅 log.txt 文件."),
TEXT("恭喜你! 新版本的 Ventoy 已经成功更新到此设备中."),
TEXT("更新 Ventoy 过程中遇到错误. 你可以重新拔插一下U盘然后重试一次, 详细信息请查阅 log.txt 文件."),
TEXT("当前有任务正在运行, 请等待..."),
};
const TCHAR * GetString(enum STR_ID ID)
{
return g_cur_lang_data->MsgString[ID];
......
......@@ -61,7 +61,8 @@ extern BOOL g_SecureBoot;
#define VENTOY_LANGUAGE_INI TEXT(".\\ventoy\\languages.ini")
#define VENTOY_CFG_INI TEXT(".\\Ventoy2Disk.ini")
#define VENTOY_CFG_INI TEXT(".\\Ventoy2Disk.ini")
#define VENTOY_CFG_INI_A ".\\Ventoy2Disk.ini"
#define VENTOY_MAX_LANGUAGE 200
#define GET_INI_STRING(Section, Key, Buf) GetPrivateProfileString(Section, Key, TEXT("#"), Buf, sizeof(Buf), VENTOY_LANGUAGE_INI)
......
......@@ -928,10 +928,19 @@ int VentoyProcSecureBoot(BOOL SecureBoot)
Log("Open bootx64 efi file %p ", file);
if (file)
{
fl_fwrite(filebuf, 1, size, file);
if (filebuf)
{
fl_fwrite(filebuf, 1, size, file);
}
fl_fflush(file);
fl_fclose(file);
}
if (filebuf)
{
free(filebuf);
}
}
}
else
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -29,6 +29,7 @@
#include "fat_filelib.h"
static ventoy_os_param g_os_param;
static ventoy_windows_data g_windows_data;
static UINT8 g_os_param_reserved[32];
static BOOL g_64bit_system = FALSE;
static ventoy_guid g_ventoy_guid = VENTOY_GUID;
......@@ -703,6 +704,40 @@ static int DeleteVentoyPart2MountPoint(DWORD PhyDrive)
return 1;
}
static int ProcessUnattendedInstallation(const char *script)
{
DWORD dw;
HKEY hKey;
LSTATUS Ret;
CHAR Letter;
CHAR CurDir[MAX_PATH];
Log("Copy unattended XML ...");
GetCurrentDirectory(sizeof(CurDir), CurDir);
Letter = CurDir[0];
if ((Letter >= 'A' && Letter <= 'Z') || (Letter >= 'a' && Letter <= 'z'))
{
Log("Current Drive Letter: %C", Letter);
}
else
{
Letter = 'X';
}
sprintf_s(CurDir, sizeof(CurDir), "%C:\\Autounattend.xml", Letter);
Log("Copy file <%s> --> <%s>", script, CurDir);
CopyFile(script, CurDir, FALSE);
Ret = RegCreateKeyEx(HKEY_LOCAL_MACHINE, "System\\Setup", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dw);
if (ERROR_SUCCESS == Ret)
{
Ret = RegSetValueEx(hKey, "UnattendFile", 0, REG_SZ, CurDir, (DWORD)(strlen(CurDir) + 1));
}
return 0;
}
static int VentoyHook(ventoy_os_param *param)
{
int rc;
......@@ -755,6 +790,24 @@ static int VentoyHook(ventoy_os_param *param)
// for protect
rc = DeleteVentoyPart2MountPoint(DiskExtent.DiskNumber);
Log("Delete ventoy mountpoint: %s", rc == 0 ? "SUCCESS" : "NO NEED");
if (g_windows_data.auto_install_script[0])
{
sprintf_s(IsoPath, sizeof(IsoPath), "%C:%s", Letter, g_windows_data.auto_install_script);
if (IsPathExist(FALSE, "%s", IsoPath))
{
Log("use auto install script %s...", IsoPath);
ProcessUnattendedInstallation(IsoPath);
}
else
{
Log("auto install script %s not exist", IsoPath);
}
}
else
{
Log("auto install no need");
}
return 0;
}
......@@ -815,11 +868,12 @@ int VentoyJump(INT argc, CHAR **argv, CHAR *LunchFile)
for (PeStart = 0; PeStart < FileSize; PeStart += 16)
{
if (CheckOsParam((ventoy_os_param *)(Buffer + PeStart)) &&
CheckPeHead(Buffer + PeStart + sizeof(ventoy_os_param)))
CheckPeHead(Buffer + PeStart + sizeof(ventoy_os_param) + sizeof(ventoy_windows_data)))
{
Log("Find os pararm at %u", PeStart);
memcpy(&g_os_param, Buffer + PeStart, sizeof(ventoy_os_param));
memcpy(&g_windows_data, Buffer + PeStart + sizeof(ventoy_os_param), sizeof(ventoy_windows_data));
memcpy(g_os_param_reserved, g_os_param.vtoy_reserved, sizeof(g_os_param_reserved));
if (g_os_param_reserved[0] == 1)
......@@ -837,7 +891,7 @@ int VentoyJump(INT argc, CHAR **argv, CHAR *LunchFile)
}
}
PeStart += sizeof(ventoy_os_param);
PeStart += sizeof(ventoy_os_param) + sizeof(ventoy_windows_data);
sprintf_s(LunchFile, MAX_PATH, "ventoy\\%s", GetFileNameInPath(ExeFileName));
SaveBuffer2File(LunchFile, Buffer + PeStart, FileSize - PeStart);
break;
......
......@@ -65,6 +65,12 @@ typedef struct ventoy_os_param
UINT8 reserved[31];
}ventoy_os_param;
typedef struct ventoy_windows_data
{
char auto_install_script[384];
UINT8 reserved[128];
}ventoy_windows_data;
#pragma pack()
......
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