mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-09-22 03:31:14 +00:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
ff7ee9c10e | ||
|
f43461a16c | ||
|
377e3fb7bc | ||
|
f62bd1be14 | ||
|
b11c38779d | ||
|
f202542c62 | ||
|
279491a36a |
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -13,8 +13,8 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Run docker-compose up
|
- name: Run docker compose up
|
||||||
run: docker-compose up
|
run: docker compose up
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ventoy-windows
|
name: ventoy-windows
|
||||||
|
@@ -1,6 +1,11 @@
|
|||||||
FROM centos:7
|
FROM centos:7
|
||||||
|
|
||||||
RUN yum -y -q install \
|
RUN sed -i \
|
||||||
|
-e 's/^mirrorlist/#mirrorlist/' \
|
||||||
|
-e 's/^#baseurl/baseurl/' \
|
||||||
|
-e 's/mirror\.centos\.org/vault.centos.org/' \
|
||||||
|
/etc/yum.repos.d/*.repo && \
|
||||||
|
yum -y -q install \
|
||||||
libXpm net-tools bzip2 wget vim gcc gcc-c++ samba dos2unix glibc-devel glibc.i686 glibc-devel.i686 \
|
libXpm net-tools bzip2 wget vim gcc gcc-c++ samba dos2unix glibc-devel glibc.i686 glibc-devel.i686 \
|
||||||
mpfr.i686 mpfr-devel.i686 rsync autogen autoconf automake libtool gettext* bison binutils \
|
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-* \
|
flex device-mapper-devel SDL libpciaccess libusb freetype freetype-devel gnu-free-* qemu-* virt-* \
|
||||||
|
@@ -128,11 +128,22 @@ insert_dir (const char *name, struct dir **root,
|
|||||||
n->name = grub_strndup (cb, ce - cb);
|
n->name = grub_strndup (cb, ce - cb);
|
||||||
if (ptr)
|
if (ptr)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Create the substring with the trailing NUL byte
|
||||||
|
* to be included in the cpio header.
|
||||||
|
*/
|
||||||
|
char *tmp_name = grub_strndup (name, ce - name);
|
||||||
|
if (!tmp_name) {
|
||||||
|
grub_free (n->name);
|
||||||
|
grub_free (n);
|
||||||
|
return grub_errno;
|
||||||
|
}
|
||||||
grub_dprintf ("linux", "Creating directory %s, %s\n", name, ce);
|
grub_dprintf ("linux", "Creating directory %s, %s\n", name, ce);
|
||||||
ptr = make_header (ptr, name, ce - name,
|
ptr = make_header (ptr, tmp_name, ce - name + 1,
|
||||||
040777, 0);
|
040777, 0);
|
||||||
|
grub_free (tmp_name);
|
||||||
}
|
}
|
||||||
size += ALIGN_UP ((ce - (char *) name)
|
size += ALIGN_UP ((ce - (char *) name + 1)
|
||||||
+ sizeof (struct newc_head), 4);
|
+ sizeof (struct newc_head), 4);
|
||||||
*head = n;
|
*head = n;
|
||||||
cur = n;
|
cur = n;
|
||||||
@@ -183,7 +194,7 @@ grub_initrd_init (int argc, char *argv[],
|
|||||||
}
|
}
|
||||||
initrd_ctx->size
|
initrd_ctx->size
|
||||||
+= ALIGN_UP (sizeof (struct newc_head)
|
+= ALIGN_UP (sizeof (struct newc_head)
|
||||||
+ grub_strlen (initrd_ctx->components[i].newc_name),
|
+ grub_strlen (initrd_ctx->components[i].newc_name) + 1,
|
||||||
4);
|
4);
|
||||||
initrd_ctx->size += insert_dir (initrd_ctx->components[i].newc_name,
|
initrd_ctx->size += insert_dir (initrd_ctx->components[i].newc_name,
|
||||||
&root, 0);
|
&root, 0);
|
||||||
@@ -194,7 +205,7 @@ grub_initrd_init (int argc, char *argv[],
|
|||||||
else if (newc)
|
else if (newc)
|
||||||
{
|
{
|
||||||
initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head)
|
initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head)
|
||||||
+ sizeof ("TRAILER!!!") - 1, 4);
|
+ sizeof ("TRAILER!!!"), 4);
|
||||||
free_dir (root);
|
free_dir (root);
|
||||||
root = 0;
|
root = 0;
|
||||||
newc = 0;
|
newc = 0;
|
||||||
@@ -217,7 +228,7 @@ grub_initrd_init (int argc, char *argv[],
|
|||||||
{
|
{
|
||||||
initrd_ctx->size = ALIGN_UP (initrd_ctx->size, 4);
|
initrd_ctx->size = ALIGN_UP (initrd_ctx->size, 4);
|
||||||
initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head)
|
initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head)
|
||||||
+ sizeof ("TRAILER!!!") - 1, 4);
|
+ sizeof ("TRAILER!!!"), 4);
|
||||||
free_dir (root);
|
free_dir (root);
|
||||||
root = 0;
|
root = 0;
|
||||||
}
|
}
|
||||||
@@ -269,14 +280,14 @@ grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx,
|
|||||||
ptr += insert_dir (initrd_ctx->components[i].newc_name,
|
ptr += insert_dir (initrd_ctx->components[i].newc_name,
|
||||||
&root, ptr);
|
&root, ptr);
|
||||||
ptr = make_header (ptr, initrd_ctx->components[i].newc_name,
|
ptr = make_header (ptr, initrd_ctx->components[i].newc_name,
|
||||||
grub_strlen (initrd_ctx->components[i].newc_name),
|
grub_strlen (initrd_ctx->components[i].newc_name) + 1,
|
||||||
0100777,
|
0100777,
|
||||||
initrd_ctx->components[i].size);
|
initrd_ctx->components[i].size);
|
||||||
newc = 1;
|
newc = 1;
|
||||||
}
|
}
|
||||||
else if (newc)
|
else if (newc)
|
||||||
{
|
{
|
||||||
ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!") - 1,
|
ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!"),
|
||||||
0, 0);
|
0, 0);
|
||||||
free_dir (root);
|
free_dir (root);
|
||||||
root = 0;
|
root = 0;
|
||||||
@@ -308,7 +319,7 @@ grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx,
|
|||||||
{
|
{
|
||||||
grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4));
|
grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4));
|
||||||
ptr += ALIGN_UP_OVERHEAD (cursize, 4);
|
ptr += ALIGN_UP_OVERHEAD (cursize, 4);
|
||||||
ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!") - 1, 0, 0);
|
ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!"), 0, 0);
|
||||||
}
|
}
|
||||||
free_dir (root);
|
free_dir (root);
|
||||||
root = 0;
|
root = 0;
|
||||||
|
75
IMG/cpio/ventoy/hook/ewe/ventoy-disk.sh
Normal file
75
IMG/cpio/ventoy/hook/ewe/ventoy-disk.sh
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
#!/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 $* ############"
|
||||||
|
|
||||||
|
if is_ventoy_hook_finished; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
wait_for_usb_disk_ready
|
||||||
|
|
||||||
|
vtdiskname=$(get_ventoy_disk_name)
|
||||||
|
if [ "$vtdiskname" = "unknown" ]; then
|
||||||
|
vtlog "ventoy disk not found"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
|
||||||
|
|
||||||
|
blkdev_num=$($VTOY_PATH/tool/dmsetup ls | $GREP ventoy | $SED 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
|
||||||
|
vtDM=$(ventoy_find_dm_id ${blkdev_num})
|
||||||
|
vtlog "blkdev_num=$blkdev_num vtDM=$vtDM ..."
|
||||||
|
|
||||||
|
while [ -n "Y" ]; do
|
||||||
|
if [ -b /dev/$vtDM ]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
sleep 0.3
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -n "$1" ]; then
|
||||||
|
vtlog "ln -s /dev/$vtDM $1"
|
||||||
|
|
||||||
|
if [ -e "$1" ]; then
|
||||||
|
vtlog "$1 already exist"
|
||||||
|
else
|
||||||
|
ln -s /dev/$vtDM "$1"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
vtLABEL=$($BUSYBOX_PATH/blkid /dev/$vtDM | $SED 's/.*LABEL="\([^"]*\)".*/\1/')
|
||||||
|
vtlog "vtLABEL is $vtLABEL"
|
||||||
|
|
||||||
|
if [ -z "$vtLABEL" ]; then
|
||||||
|
vtLABEL=$($SED "s/.*label=\([^ ]*\)/\1/" /proc/cmdline)
|
||||||
|
vtlog "vtLABEL is $vtLABEL from cmdline"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e "/dev/disk/by-label/$vtLABEL" ]; then
|
||||||
|
vtlog "$1 already exist"
|
||||||
|
else
|
||||||
|
ln -s /dev/$vtDM "/dev/disk/by-label/$vtLABEL"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# OK finish
|
||||||
|
set_ventoy_hook_finish
|
25
IMG/cpio/ventoy/hook/ewe/ventoy-hook.sh
Normal file
25
IMG/cpio/ventoy/hook/ewe/ventoy-hook.sh
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/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/>.
|
||||||
|
#
|
||||||
|
#************************************************************************************
|
||||||
|
|
||||||
|
. $VTOY_PATH/hook/ventoy-os-lib.sh
|
||||||
|
|
||||||
|
echo "hook live.init" >> $VTLOG
|
||||||
|
|
||||||
|
$SED "1i $BUSYBOX_PATH/sh $VTOY_PATH/hook/ewe/ventoy-disk.sh" -i /lib/tinyramfs/hook.d/live/live.init
|
||||||
|
|
@@ -72,27 +72,29 @@ ventoy_unpack_initramfs() {
|
|||||||
|
|
||||||
for vtx in '1F8B zcat' '1F9E zcat' '425A bzcat' '5D00 lzcat' 'FD37 xzcat' '894C lzopcat' '0221 lz4cat' '28B5 zstdcat' '3037 cat' '4C5A lunzip -c'; do
|
for vtx in '1F8B zcat' '1F9E zcat' '425A bzcat' '5D00 lzcat' 'FD37 xzcat' '894C lzopcat' '0221 lz4cat' '28B5 zstdcat' '3037 cat' '4C5A lunzip -c'; do
|
||||||
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 -ne 0 ]; then
|
||||||
if [ "${vtx:5}" = "xzcat" ]; then
|
dd if=$vtfile skip=$vtskip iflag=skip_bytes status=none > ${vtfile}.skip
|
||||||
rm -f $VTOY_PATH/xzlog
|
rm -f $vtfile
|
||||||
${vtx:5} $vtfile 2> $VTOY_PATH/xzlog | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
|
mv ${vtfile}.skip $vtfile
|
||||||
if grep -q 'corrupted data' $VTOY_PATH/xzlog; then
|
fi
|
||||||
echo 'xzcat failed, now try xzminidec...' >> $VTLOG
|
|
||||||
rm -f $VTOY_PATH/xzlog
|
|
||||||
cat $vtfile | xzminidec 2> $VTOY_PATH/xzlog | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
|
|
||||||
|
|
||||||
if grep -q 'limit' $VTOY_PATH/xzlog; then
|
if [ "${vtx:5}" = "xzcat" ]; then
|
||||||
echo 'xzminidec failed, now try xzcat_musl ...' >> $VTLOG
|
rm -f $VTOY_PATH/xzlog
|
||||||
xzcat_musl $vtfile | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
|
${vtx:5} $vtfile 2> $VTOY_PATH/xzlog | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
|
||||||
fi
|
if grep -q 'corrupted data' $VTOY_PATH/xzlog; then
|
||||||
|
echo 'xzcat failed, now try xzminidec...' >> $VTLOG
|
||||||
|
rm -f $VTOY_PATH/xzlog
|
||||||
|
cat $vtfile | xzminidec 2> $VTOY_PATH/xzlog | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
|
||||||
|
|
||||||
|
if grep -q 'limit' $VTOY_PATH/xzlog; then
|
||||||
|
echo 'xzminidec failed, now try xzcat_musl ...' >> $VTLOG
|
||||||
|
xzcat_musl $vtfile | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
${vtx:5} $vtfile | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
dd if=$vtfile skip=$vtskip iflag=skip_bytes status=none | ${vtx:5} | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
|
${vtx:5} $vtfile | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
|
||||||
fi
|
fi
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@@ -384,6 +384,12 @@ ventoy_get_os_type() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -f /etc/tinyramfs/config ]; then
|
||||||
|
if $GREP -q 'EWE_ISO' /etc/tinyramfs/config; then
|
||||||
|
echo "ewe"; return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo "default"
|
echo "default"
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
@@ -403,10 +403,12 @@ function distro_specify_initrd_file_phase2 {
|
|||||||
vt_linux_specify_initrd_file /images/pxeboot/initrd.img
|
vt_linux_specify_initrd_file /images/pxeboot/initrd.img
|
||||||
elif [ -f (loop)/live/initrd ]; then
|
elif [ -f (loop)/live/initrd ]; then
|
||||||
vt_linux_specify_initrd_file /live/initrd
|
vt_linux_specify_initrd_file /live/initrd
|
||||||
|
elif [ -f (loop)/initramfs-linux.img ]; then
|
||||||
|
vt_linux_specify_initrd_file /initramfs-linux.img
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function ventoy_get_ghostbsd_ver {
|
function ventoy_get_ghostbsd_ver {
|
||||||
# fallback to parse version from elf /boot/kernel/kernel
|
# fallback to parse version from elf /boot/kernel/kernel
|
||||||
set vt_freebsd_ver=xx
|
set vt_freebsd_ver=xx
|
||||||
@@ -2399,7 +2401,7 @@ function mimg_common_menuentry {
|
|||||||
#############################################################
|
#############################################################
|
||||||
#############################################################
|
#############################################################
|
||||||
|
|
||||||
set VENTOY_VERSION="1.0.99"
|
set VENTOY_VERSION="1.1.00"
|
||||||
|
|
||||||
#ACPI not compatible with Window7/8, so disable by default
|
#ACPI not compatible with Window7/8, so disable by default
|
||||||
set VTOY_PARAM_NO_ACPI=1
|
set VTOY_PARAM_NO_ACPI=1
|
||||||
|
Reference in New Issue
Block a user