mirror of https://github.com/ventoy/Ventoy.git
1.0.08beta1
This commit is contained in:
parent
d5b829f8e8
commit
ad9a031092
|
@ -17,5 +17,21 @@
|
||||||
#
|
#
|
||||||
#************************************************************************************
|
#************************************************************************************
|
||||||
|
|
||||||
ventoy_systemd_udevd_work_around
|
if [ -e /init ] && $GREP -q '^mountroot$' /init; then
|
||||||
ventoy_add_udev_rule "$VTOY_PATH/hook/debian/udev_disk_hook.sh %k"
|
echo "Here before mountroot ..." >> $VTLOG
|
||||||
|
|
||||||
|
$SED "/^mountroot$/i\\$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/disk_mount_hook.sh" -i /init
|
||||||
|
$SED "/^mountroot$/i\\export LIVEMEDIA=/dev/mapper/ventoy" -i /init
|
||||||
|
$SED "/^mountroot$/i\\export LIVE_MEDIA=/dev/mapper/ventoy" -i /init
|
||||||
|
|
||||||
|
elif [ -e /init ] && $GREP -q '/start-udev$' /init; then
|
||||||
|
echo "Here use notify ..." >> $VTLOG
|
||||||
|
|
||||||
|
ventoy_set_inotify_script debian/ventoy-inotifyd-hook.sh
|
||||||
|
$SED "/start-udev$/i\\mount -n -o mode=0755 -t devtmpfs devtmpfs /dev" -i /init
|
||||||
|
$SED "/start-udev$/i\\$BUSYBOX_PATH/sh $VTOY_PATH/hook/default/ventoy-inotifyd-start.sh" -i /init
|
||||||
|
else
|
||||||
|
echo "Here use udev hook ..." >> $VTLOG
|
||||||
|
ventoy_systemd_udevd_work_around
|
||||||
|
ventoy_add_udev_rule "$VTOY_PATH/hook/debian/udev_disk_hook.sh %k"
|
||||||
|
fi
|
||||||
|
|
|
@ -19,10 +19,6 @@
|
||||||
|
|
||||||
. /ventoy/hook/ventoy-hook-lib.sh
|
. /ventoy/hook/ventoy-hook-lib.sh
|
||||||
|
|
||||||
if is_ventoy_hook_finished; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
vtlog "####### $0 $* ########"
|
vtlog "####### $0 $* ########"
|
||||||
|
|
||||||
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||||
|
@ -36,9 +32,4 @@ if [ "$vtdiskname" = "unknown" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2"
|
$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/udev_disk_hook.sh "${vtdiskname#/dev/}2"
|
||||||
|
|
||||||
PATH=$VTPATH_OLD
|
|
||||||
|
|
||||||
set_ventoy_hook_finish
|
|
||||||
|
|
|
@ -86,6 +86,10 @@ if [ -z "$dmsetup_path" ]; then
|
||||||
ventoy_os_install_dmsetup "/dev/${1:0:-1}"
|
ventoy_os_install_dmsetup "/dev/${1:0:-1}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! $GREP -q 'device-mapper' /proc/devices; then
|
||||||
|
ventoy_os_install_dmsetup "/dev/${1:0:-1}"
|
||||||
|
fi
|
||||||
|
|
||||||
ventoy_udev_disk_common_hook $*
|
ventoy_udev_disk_common_hook $*
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -103,7 +107,14 @@ else
|
||||||
else
|
else
|
||||||
vtlog "No boot param, need to mount"
|
vtlog "No boot param, need to mount"
|
||||||
$BUSYBOX_PATH/mkdir /cdrom
|
$BUSYBOX_PATH/mkdir /cdrom
|
||||||
$BUSYBOX_PATH/mount -t iso9660 $VTOY_DM_PATH /cdrom
|
|
||||||
|
if [ -b $VTOY_DM_PATH ]; then
|
||||||
|
vtlog "mount $VTOY_DM_PATH ..."
|
||||||
|
$BUSYBOX_PATH/mount -t iso9660 $VTOY_DM_PATH /cdrom
|
||||||
|
else
|
||||||
|
vtlog "mount /dev/$1 ..."
|
||||||
|
$BUSYBOX_PATH/mount -t iso9660 /dev/$1 /cdrom
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -52,14 +52,6 @@ ventoy_get_debian_distro() {
|
||||||
echo 'pve'; return
|
echo 'pve'; return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if $GREP -q '[Dd]eepin' /proc/version; then
|
|
||||||
echo 'deepin'; return
|
|
||||||
fi
|
|
||||||
|
|
||||||
if $GREP -q '[Uu][Oo][Ss] ' /proc/version; then
|
|
||||||
echo 'deepin'; return
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d /porteus ]; then
|
if [ -d /porteus ]; then
|
||||||
echo 'porteus'; return
|
echo 'porteus'; return
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -19,29 +19,17 @@
|
||||||
|
|
||||||
. /ventoy/hook/ventoy-hook-lib.sh
|
. /ventoy/hook/ventoy-hook-lib.sh
|
||||||
|
|
||||||
vtlog "####### $0 $* ########"
|
if is_ventoy_hook_finished; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
vtlog "##### INOTIFYD: $2/$3 is created ..."
|
||||||
|
|
||||||
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||||
|
|
||||||
vtmountpoint=$1
|
if is_inotify_ventoy_part $3; then
|
||||||
|
vtlog "find ventoy partition $3 ..."
|
||||||
if is_ventoy_hook_finished; then
|
$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/udev_disk_hook.sh "$3"
|
||||||
PATH=$VTPATH_OLD
|
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
wait_for_usb_disk_ready
|
PATH=$VTPATH_OLD
|
||||||
|
|
||||||
vtdiskname=$(get_ventoy_disk_name)
|
|
||||||
if [ "$vtdiskname" = "unknown" ]; then
|
|
||||||
vtlog "ventoy disk not found"
|
|
||||||
PATH=$VTPATH_OLD
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2"
|
|
||||||
|
|
||||||
$BUSYBOX_PATH/mount -t iso9660 $VTOY_DM_PATH $vtmountpoint
|
|
||||||
|
|
||||||
# OK finish
|
|
||||||
set_ventoy_hook_finish
|
|
|
@ -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/>.
|
||||||
|
#
|
||||||
|
#************************************************************************************
|
||||||
|
|
||||||
|
. /ventoy/hook/ventoy-hook-lib.sh
|
||||||
|
|
||||||
|
vtHook=$($CAT $VTOY_PATH/inotifyd-hook-script.txt)
|
||||||
|
|
||||||
|
vtlog "... start inotifyd listen $vtHook ..."
|
||||||
|
$BUSYBOX_PATH/nohup $VTOY_PATH/tool/inotifyd $vtHook /dev:n 2>&- &
|
|
@ -28,6 +28,13 @@ else
|
||||||
$CAT $VTOY_PATH/hook/default/13-dm-disk.rules > "$DISTRO_UDEV_DIR/13-dm-disk.rules"
|
$CAT $VTOY_PATH/hook/default/13-dm-disk.rules > "$DISTRO_UDEV_DIR/13-dm-disk.rules"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ventoy_systemd_udevd_work_around
|
|
||||||
|
|
||||||
ventoy_add_udev_rule "$VTOY_PATH/hook/default/udev_disk_hook.sh %k"
|
if $GREP -q '^mount_setup$' init; then
|
||||||
|
echo "Here use notify ..." >> $VTLOG
|
||||||
|
|
||||||
|
ventoy_set_inotify_script manjaro/ventoy-inotifyd-hook.sh
|
||||||
|
$SED "/^mount_setup$/a\\$BUSYBOX_PATH/sh $VTOY_PATH/hook/default/ventoy-inotifyd-start.sh" -i /init
|
||||||
|
else
|
||||||
|
ventoy_systemd_udevd_work_around
|
||||||
|
ventoy_add_udev_rule "$VTOY_PATH/hook/default/udev_disk_hook.sh %k"
|
||||||
|
fi
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
#!/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
|
||||||
|
|
||||||
|
if is_ventoy_hook_finished; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
vtlog "##### INOTIFYD: $2/$3 is created ..."
|
||||||
|
|
||||||
|
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||||
|
|
||||||
|
if is_inotify_ventoy_part $3; then
|
||||||
|
vtlog "find ventoy partition $3 ..."
|
||||||
|
$BUSYBOX_PATH/sh $VTOY_PATH/hook/default/udev_disk_hook.sh "$3"
|
||||||
|
|
||||||
|
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})
|
||||||
|
vtLABEL=$($BUSYBOX_PATH/blkid /dev/$vtDM | $AWK '{print $2}' | $SED 's/.*"\(.*\)".*/\1/')
|
||||||
|
|
||||||
|
vtlog "blkdev_num=$blkdev_num vtDM=$vtDM label $vtLABEL ..."
|
||||||
|
|
||||||
|
if ! [ -d /dev/disk/by-label ]; then
|
||||||
|
mkdir -p /dev/disk/by-label
|
||||||
|
fi
|
||||||
|
$BUSYBOX_PATH/cp -a /dev/$vtDM /dev/disk/by-label/$vtLABEL
|
||||||
|
fi
|
||||||
|
|
||||||
|
PATH=$VTPATH_OLD
|
|
@ -19,10 +19,13 @@
|
||||||
|
|
||||||
. $VTOY_PATH/hook/ventoy-os-lib.sh
|
. $VTOY_PATH/hook/ventoy-os-lib.sh
|
||||||
|
|
||||||
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"
|
||||||
|
|
||||||
#$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/rhel7/ventoy-disk.sh /lib/dracut/hooks/initqueue/01-ventoy-disk.sh
|
$SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE inst.stage2=hd:/dev/dm-0#" -i /lib/dracut-lib.sh
|
||||||
|
ventoy_set_inotify_script rhel7/ventoy-inotifyd-hook.sh
|
||||||
|
|
||||||
|
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/default/ventoy-inotifyd-start.sh /lib/dracut/hooks/pre-udev/01-ventoy-inotifyd-start.sh
|
||||||
|
|
||||||
# suppress write protected mount warning
|
# suppress write protected mount warning
|
||||||
if [ -e /usr/sbin/anaconda-diskroot ]; then
|
if [ -e /usr/sbin/anaconda-diskroot ]; then
|
||||||
|
|
|
@ -17,31 +17,31 @@
|
||||||
#
|
#
|
||||||
#************************************************************************************
|
#************************************************************************************
|
||||||
|
|
||||||
drop_initramfs_workaround() {
|
. /ventoy/hook/ventoy-hook-lib.sh
|
||||||
mainfilelist=$($FIND / -name 9990-main.sh)
|
|
||||||
|
if is_ventoy_hook_finished; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
vtlog "##### INOTIFYD: $2/$3 is created ..."
|
||||||
|
|
||||||
|
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||||
|
|
||||||
|
if is_inotify_ventoy_part $3; then
|
||||||
|
vtlog "find ventoy partition ..."
|
||||||
|
$BUSYBOX_PATH/sh $VTOY_PATH/hook/default/udev_disk_hook.sh $3 noreplace
|
||||||
|
|
||||||
echo "mainfilelist=$mainfilelist" >> $VTLOG
|
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})
|
||||||
if [ -z "$mainfilelist" ]; then
|
|
||||||
return
|
if [ "$vtDM" = "dm-0" ]; then
|
||||||
|
vtlog "This is dm-0, OK ..."
|
||||||
|
else
|
||||||
|
vtlog "####### This is $vtDM ####### this is abnormal ..."
|
||||||
|
ventoy_swap_device /dev/dm-0 /dev/$vtDM
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for vtfile in $mainfilelist; do
|
|
||||||
vtcnt=$($GREP -c 'panic.*Unable to find a medium' $vtfile)
|
|
||||||
if [ $vtcnt -ne 1 ]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "direct_hook insert ..." >> $VTLOG
|
set_ventoy_hook_finish
|
||||||
|
fi
|
||||||
for vtfile in $mainfilelist; do
|
|
||||||
$SED "s#panic.*Unable to find a medium.*#$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/deepin-disk.sh \$mountpoint; livefs_root=\$mountpoint#" -i $vtfile
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
ventoy_systemd_udevd_work_around
|
|
||||||
ventoy_add_udev_rule "$VTOY_PATH/hook/debian/udev_disk_hook.sh %k"
|
|
||||||
|
|
||||||
drop_initramfs_workaround
|
|
||||||
|
|
||||||
|
PATH=$VTPATH_OLD
|
|
@ -421,4 +421,37 @@ ventoy_udev_disk_common_hook() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_inotify_ventoy_part() {
|
||||||
|
if echo $1 | grep -q "2$"; then
|
||||||
|
if ! [ -e /sys/block/$1 ]; then
|
||||||
|
if [ -e /sys/class/block/$1 ]; then
|
||||||
|
if [ -e /dev/${1:0:-1} ]; then
|
||||||
|
$VTOY_PATH/tool/vtoydump -f $VTOY_PATH/ventoy_os_param -c ${1:0:-1}
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ "1" = "0" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
ventoy_find_dm_id() {
|
||||||
|
for vt in $($BUSYBOX_PATH/ls /sys/block/); do
|
||||||
|
if [ "${vt:0:3}" = "dm-" ]; then
|
||||||
|
vtMajorMinor=$($CAT /sys/block/$vt/dev)
|
||||||
|
if [ "$vtMajorMinor" = "$1" ]; then
|
||||||
|
echo ${vt}
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo 'xx'
|
||||||
|
}
|
||||||
|
|
||||||
|
ventoy_swap_device() {
|
||||||
|
mv $1 $VTOY_PATH/swap_tmp_dev
|
||||||
|
mv $2 $1
|
||||||
|
mv $VTOY_PATH/swap_tmp_dev $2
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,3 +101,7 @@ ventoy_print_yum_repo() {
|
||||||
echo "gpgcheck=0"
|
echo "gpgcheck=0"
|
||||||
echo "priority=0"
|
echo "priority=0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ventoy_set_inotify_script() {
|
||||||
|
echo $VTOY_PATH/hook/$1 > $VTOY_PATH/inotifyd-hook-script.txt
|
||||||
|
}
|
||||||
|
|
Binary file not shown.
|
@ -395,7 +395,7 @@ function legacy_iso_memdisk {
|
||||||
#############################################################
|
#############################################################
|
||||||
#############################################################
|
#############################################################
|
||||||
|
|
||||||
set VENTOY_VERSION="1.0.07"
|
set VENTOY_VERSION="1.0.08b1"
|
||||||
|
|
||||||
#disable timeout
|
#disable timeout
|
||||||
unset timeout
|
unset timeout
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -448,7 +448,7 @@ static int vtoy_check_device(ventoy_os_param *param, const char *device)
|
||||||
debug("param->vtoy_disk_size=%llu size=%llu\n",
|
debug("param->vtoy_disk_size=%llu size=%llu\n",
|
||||||
(unsigned long long)param->vtoy_disk_size, (unsigned long long)size);
|
(unsigned long long)param->vtoy_disk_size, (unsigned long long)size);
|
||||||
|
|
||||||
if (param->vtoy_disk_size == size &&
|
if ((param->vtoy_disk_size == size || param->vtoy_disk_size == size + 512) &&
|
||||||
memcmp(vtguid, param->vtoy_disk_guid, 16) == 0)
|
memcmp(vtguid, param->vtoy_disk_guid, 16) == 0)
|
||||||
{
|
{
|
||||||
debug("<%s> is right ventoy disk\n", device);
|
debug("<%s> is right ventoy disk\n", device);
|
||||||
|
|
Loading…
Reference in New Issue