1 #!/ventoy/busybox/tmpsh
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 #************************************************************************************
20 ####################################################################
22 # Step 1 : extract busybox & set busybox enviroment #
24 ####################################################################
26 export VTOY_ORG_PATH=$PATH
27 export VTOY_PATH=/ventoy
28 export BUSYBOX_PATH=$VTOY_PATH/busybox
29 export VTLOG=$VTOY_PATH/log
30 export FIND=$BUSYBOX_PATH/find
31 export GREP=$BUSYBOX_PATH/grep
32 export EGREP=$BUSYBOX_PATH/egrep
33 export CAT=$BUSYBOX_PATH/cat
34 export AWK=$BUSYBOX_PATH/awk
35 export SED=$BUSYBOX_PATH/sed
36 export SLEEP=$BUSYBOX_PATH/sleep
37 export HEAD=$BUSYBOX_PATH/head
39 $BUSYBOX_PATH/tmpxz -d $BUSYBOX_PATH/busybox.xz
40 $BUSYBOX_PATH/busybox --install $BUSYBOX_PATH
42 export PATH=$BUSYBOX_PATH/:$VTOY_PATH/tool
44 export VTOY_BREAK_LEVEL=$(hexdump -n 1 -s 449 -e '1/1 "%02x"' $VTOY_PATH/ventoy_os_param)
45 export VTOY_DEBUG_LEVEL=$(hexdump -n 1 -s 450 -e '1/1 "%02x"' $VTOY_PATH/ventoy_os_param)
47 #Fixme: busybox shell output redirect seems to have some bug in rhel5
48 if uname -a | grep -q el5; then
52 if [ -z "$VTOY_REDT_BUG" ]; then
53 echo "============== VENTOY =================" >>$VTLOG
59 if [ -n "$VTOY_REDT_BUG" ]; then
60 xz -d -c hook.cpio.xz | cpio -idm
61 xz -d -c tool.cpio.xz | cpio -idm
63 xz -d -c hook.cpio.xz | cpio -idm 2>>$VTLOG
64 xz -d -c tool.cpio.xz | cpio -idm 2>>$VTLOG
70 ####################################################################
72 # Step 2 : Hand over to ventoy init #
74 ####################################################################
75 exec $BUSYBOX_PATH/sh $VTOY_PATH/init