2 #************************************************************************************
3 # Copyright (c) 2020, longpanda <admin@ventoy.net>
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License as
7 # published by the Free Software Foundation; either version 3 of the
8 # License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, see <http://www.gnu.org/licenses/>.
18 #************************************************************************************
21 ###################################################################
23 # Step 1 : parse kernel debug parameter #
25 ####################################################################
26 [ -d /proc ] || mkdir /proc; mount -t proc proc /proc
27 vtcmdline=$(cat /proc/cmdline)
28 vtkerver=$(cat /proc/version)
29 umount /proc; rm -rf /proc
31 echo "kenel version=$vtkerver" >>$VTLOG
32 echo "kenel cmdline=$vtcmdline" >>$VTLOG
35 if [ "$VTOY_BREAK_LEVEL" = "01" ] || [ "$VTOY_BREAK_LEVEL" = "11" ]; then
37 echo -e "\n\n\033[32m ################################################# \033[0m"
38 echo -e "\033[32m ################ VENTOY DEBUG ################### \033[0m"
39 echo -e "\033[32m ################################################# \033[0m \n"
41 if [ "$VTOY_BREAK_LEVEL" = "11" ]; then
48 ####################################################################
50 # Step 2 : Extract injection archive #
52 ####################################################################
53 ventoy_unpack_injection() {
54 vtmagic=$(hexdump -n 2 -e '2/1 "%02X"' $VTOY_PATH/ventoy_injection)
55 echo "ventoy_unpack_injection vtmagic=$vtmagic ..."
57 if [ "1F8B" = "$vtmagic" ] || [ "1F9E" = "$vtmagic" ]; then
58 echo "tar.gz tar -xzvf"
59 tar -xzvf $VTOY_PATH/ventoy_injection -C /
60 elif [ "425A" = "$vtmagic" ]; then
61 echo "tar.bz2 tar -xjvf"
62 tar -xjvf $VTOY_PATH/ventoy_injection -C /
63 elif [ "FD37" = "$vtmagic" ]; then
64 echo "tar.xz tar -xJvf"
65 tar -xJvf $VTOY_PATH/ventoy_injection -C /
66 elif [ "5D00" = "$vtmagic" ]; then
67 echo "tar.lzma tar -xavf"
68 tar -xavf $VTOY_PATH/ventoy_injection -C /
71 unzip -o $VTOY_PATH/ventoy_injection -d /
75 if [ -e $VTOY_PATH/ventoy_injection ]; then
76 echo "### decompress injection ... ###" >>$VTLOG
77 ventoy_unpack_injection > $VTOY_PATH/injection.log 2>&1
81 ####################################################################
83 # Step 3 : Hand over to ventoy_loop.sh #
85 ####################################################################
86 echo "Now hand over to ventoy.sh" >>$VTLOG
87 . $VTOY_PATH/tool/vtoytool_install.sh
89 export PATH=$VTOY_ORG_PATH
90 exec $BUSYBOX_PATH/sh $VTOY_PATH/ventoy_loop.sh