update for new release

This commit is contained in:
longpanda 2020-07-22 23:30:01 +08:00
parent a6d3ecc7a9
commit 0f8478fbe1
433 changed files with 2597 additions and 620 deletions

View file

@ -0,0 +1,71 @@
#!/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 "####### $0 $* ########"
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
wait_for_usb_disk_ready
vtdiskname=$(get_ventoy_disk_name)
if [ "$vtdiskname" = "unknown" ]; then
vtlog "ventoy disk not found"
PATH=$VTPATH_OLD
exit 0
fi
vtoydm -i -f $VTOY_PATH/ventoy_image_map -d $vtdiskname > $VTOY_PATH/iso_file_list
vtline=$(grep '[-][-] drivers-.*\.squashfs' $VTOY_PATH/iso_file_list)
sector=$(echo $vtline | awk '{print $(NF-1)}')
length=$(echo $vtline | awk '{print $NF}')
vtoydm -e -f $VTOY_PATH/ventoy_image_map -d $vtdiskname -s $sector -l $length -o $VTOY_PATH/driver.squashfs
mount -t squashfs $VTOY_PATH/driver.squashfs /lib/modules
modprobe dm-mod
umount /lib/modules
rm -f $VTOY_PATH/driver.squashfs
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/')
blkdev_dev=$($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 ! [ -b /dev/$vtDM ]; then
mknod -m 0660 /dev/$vtDM b $blkdev_dev
fi
if mount /dev/$vtDM /media/ydfs; then
vtlog "mount success"
else
vtlog "mount failed"
fi
PATH=$VTPATH_OLD
set_ventoy_hook_finish

View file

@ -0,0 +1,23 @@
#!/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/>.
#
#************************************************************************************
$SED "s#/busybox/bin/sleep 2#/busybox/bin/sleep 10#" -i /etc/init.d/tty1
$SED "/install *-d *.media.ydfs/a return" -i /ydfs/detect/media
$SED "/install *-d *.media.ydfs/a $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/linuxconsole-disk.sh" -i /ydfs/detect/media

View file

@ -50,7 +50,7 @@ ventoy_os_install_dmsetup() {
if $GREP -q 'device-mapper' /proc/devices; then
vtlog "device mapper module is loaded"
else
vtlog"device mapper module is NOT loaded, now load it..."
vtlog "device mapper module is NOT loaded, now load it..."
VER=$($BUSYBOX_PATH/uname -r)
KO=$($FIND /lib/modules/$VER/kernel/drivers/md -name "dm-mod*")

View file

@ -60,6 +60,10 @@ ventoy_get_debian_distro() {
echo 'porteus'; return
fi
if $GREP -q 'linuxconsole' /proc/version; then
echo 'linuxconsole'; return
fi
echo 'default'
}

View file

@ -0,0 +1,63 @@
#!/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
while [ -n "1" ]; do
if [ -e /dev/null ]; then
break
else
$SLEEP 0.5
fi
done
while [ -n "1" ]; do
if [ -e /sys/block ]; then
break
else
$SLEEP 0.5
fi
done
while [ -n "Y" ]; do
vtdiskname=$(get_ventoy_disk_name)
if [ "$vtdiskname" != "unknown" ]; then
break
else
$SLEEP 0.5
fi
done
vtshortdev=${vtdiskname#/dev/}
if ! [ -b $vtdiskname ]; then
blkdev=$($CAT /sys/class/block/$vtshortdev/dev | $SED 's/:/ /g')
$BUSYBOX_PATH/mknod -m 0660 $vtdiskname b $blkdev
fi
if ! [ -b "${vtdiskname}2" ]; then
blkdev=$($CAT /sys/class/block/${vtshortdev}2/dev | $SED 's/:/ /g')
$BUSYBOX_PATH/mknod -m 0660 "${vtdiskname}2" b $blkdev
fi
$BUSYBOX_PATH/ls /dev/ > /dev/console
$BUSYBOX_PATH/sh $VTOY_PATH/hook/vine/udev_disk_hook.sh "${vtdiskname#/dev/}2"

View file

@ -0,0 +1,79 @@
#!/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
vtCheatLoop=loop6
ventoy_os_install_dmsetup() {
vtlog "ventoy_os_install_dmsetup $1"
vt_usb_disk=$1
# dump iso file location
$VTOY_PATH/tool/vtoydm -i -f $VTOY_PATH/ventoy_image_map -d ${vt_usb_disk} > $VTOY_PATH/iso_file_list
# install dmsetup
LINE=$($GREP 'kernel-[0-9].*\.rpm' $VTOY_PATH/iso_file_list)
if [ $? -eq 0 ]; then
install_rpm_from_line "$LINE" ${vt_usb_disk}
fi
$BUSYBOX_PATH/modprobe dm-mod
vtlog "dmsetup install finish, now check it..."
dmsetup_path=/ventoy/tool/dmsetup
if [ -z "$dmsetup_path" ]; then
vterr "dmsetup still not found after install"
elif $dmsetup_path info >> $VTLOG 2>&1; then
vtlog "$dmsetup_path work ok"
else
vterr "$dmsetup_path not work"
fi
}
if is_ventoy_hook_finished || not_ventoy_disk "${1:0:-1}"; then
# /dev/vtCheatLoop come first
if [ "$1" = "$vtCheatLoop" ] && [ -b $VTOY_DM_PATH ]; then
ventoy_copy_device_mapper /dev/$vtCheatLoop
fi
exit 0
fi
ventoy_os_install_dmsetup "/dev/${1:0:-1}"
ventoy_udev_disk_common_hook $* "noreplace"
$BUSYBOX_PATH/mount $VTOY_DM_PATH /mnt/ventoy
#
# We do a trick for rhel6 series here.
# Use /dev/$vtCheatLoop and wapper it as a removable cdrom with bind mount.
# Then the anaconda installer will accept /dev/$vtCheatLoop as the install medium.
#
ventoy_copy_device_mapper /dev/$vtCheatLoop
$BUSYBOX_PATH/cp -a /sys/devices/virtual/block/$vtCheatLoop /tmp/ >> $VTLOG 2>&1
echo 19 > /tmp/$vtCheatLoop/capability
$BUSYBOX_PATH/mount --bind /tmp/$vtCheatLoop /sys/block/$vtCheatLoop >> $VTLOG 2>&1
# OK finish
set_ventoy_hook_finish

View file

@ -0,0 +1,28 @@
#!/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
$BUSYBOX_PATH/mkdir -p /etc/anaconda.repos.d /mnt/ventoy
ventoy_print_yum_repo "ventoy" "file:///mnt/ventoy" > /etc/anaconda.repos.d/ventoy.repo
$BUSYBOX_PATH/mknod -m 0660 /dev/null c 1 3
$VTOY_PATH/hook/vine/dev-listen.sh &

View file

@ -183,7 +183,30 @@ fi
####################################################################
# #
# Step 3 : Hand over to ventoy.sh #
# Step 3 : Extract injection archive #
# #
####################################################################
if [ -e $VTOY_PATH/ventoy_injection ]; then
echo "decompress injection ..." >>$VTLOG
vtmagic=$(hexdump -n 2 -e '2/1 "%02X"' $VTOY_PATH/ventoy_injection)
echo "vtmagic=$vtmagic ..." >>$VTLOG
if [ "1F8B" = "vtmagic" ] || [ "1F9E" = "vtmagic" ]; then
zcat $VTOY_PATH/ventoy_injection | tar -xf -C /
elif [ "425A" = "vtmagic" ]; then
bzcat $VTOY_PATH/ventoy_injection | tar -xf -C /
elif [ "FD37" = "vtmagic" ]; then
xzcat $VTOY_PATH/ventoy_injection | tar -xf -C /
else
unzip -o -q $VTOY_PATH/ventoy_injection -d /
fi
fi
####################################################################
# #
# Step 4 : Hand over to ventoy.sh #
# #
####################################################################
echo "Now hand over to ventoy.sh" >>$VTLOG

View file

@ -221,6 +221,9 @@ ventoy_get_os_type() {
echo 'kwort'; return
fi
if $GREP -q 'iwamoto' /proc/version; then
echo 'vine'; return
fi
echo "default"
}
@ -248,6 +251,7 @@ if [ "$VTOY_BREAK_LEVEL" = "03" ] || [ "$VTOY_BREAK_LEVEL" = "13" ]; then
exec $BUSYBOX_PATH/sh
fi
####################################################################
# #
# Step 4 : Hand over to real init #