Ventoy/INSTALL/Ventoy2Disk.sh

74 lines
1.5 KiB
Bash
Raw Normal View History

2020-04-04 12:07:50 -04:00
#!/bin/sh
2020-10-16 08:26:24 -04:00
if ! [ -f ./tool/ventoy_lib.sh ]; then
if [ -f ${0%Ventoy2Disk.sh}/tool/ventoy_lib.sh ]; then
cd ${0%Ventoy2Disk.sh}
fi
fi
2020-09-02 07:29:19 -04:00
if [ -f ./ventoy/version ]; then
curver=$(cat ./ventoy/version)
fi
2020-04-04 12:07:50 -04:00
2020-12-11 18:56:52 -05:00
OLDDIR=$(pwd)
if uname -a | egrep -q 'aarch64|arm64'; then
export TOOLDIR=aarch64
elif uname -a | egrep -q 'x86_64|amd64'; then
export TOOLDIR=x86_64
else
export TOOLDIR=i386
fi
export PATH=./tool/$TOOLDIR:$PATH
2020-04-04 12:07:50 -04:00
echo ''
2020-09-02 07:29:19 -04:00
echo '**********************************************'
2020-12-11 18:56:52 -05:00
echo " Ventoy: $curver $TOOLDIR"
2020-09-02 07:29:19 -04:00
echo " longpanda admin@ventoy.net"
echo " https://www.ventoy.net"
echo '**********************************************'
2020-04-04 12:07:50 -04:00
echo ''
2020-05-16 02:17:36 -04:00
2020-04-30 10:40:40 -04:00
if ! [ -f ./boot/boot.img ]; then
if [ -d ./grub ]; then
echo "Don't run Ventoy2Disk.sh here, please download the released install package, and run the script in it."
2020-04-30 10:40:40 -04:00
else
echo "Please run under the correct directory!"
2020-04-04 12:07:50 -04:00
fi
2020-05-24 08:24:34 -04:00
exit 1
fi
2020-12-11 18:56:52 -05:00
echo "############# Ventoy2Disk $* [$TOOLDIR] ################" >> ./log.txt
2020-10-16 08:26:24 -04:00
date >> ./log.txt
2020-04-24 09:58:00 -04:00
#decompress tool
2020-12-11 18:56:52 -05:00
if [ -f ./tool/$TOOLDIR/ash ]; then
2020-10-16 08:26:24 -04:00
echo "no need to decompress tools" >> ./log.txt
else
2020-12-11 18:56:52 -05:00
cd ./tool/$TOOLDIR
2020-10-16 08:26:24 -04:00
2020-12-11 18:56:52 -05:00
[ -f ./xzcat ] && chmod +x ./xzcat
2020-10-16 08:26:24 -04:00
for file in $(ls *.xz); do
2020-10-16 08:26:24 -04:00
xzcat $file > ${file%.xz}
2020-12-11 18:56:52 -05:00
[ -f ./$file ] && rm -f ./$file
2020-05-23 09:19:26 -04:00
done
2020-12-11 18:56:52 -05:00
cd $OLDDIR
chmod +x -R ./tool/$TOOLDIR
2020-04-04 12:07:50 -04:00
fi
2020-10-16 08:26:24 -04:00
if [ -f /bin/bash ]; then
2020-12-11 18:56:52 -05:00
/bin/bash ./tool/VentoyWorker.sh $*
2020-10-16 08:26:24 -04:00
else
2020-12-11 18:56:52 -05:00
ash ./tool/VentoyWorker.sh $*
2020-10-16 08:26:24 -04:00
fi
2020-07-31 11:08:17 -04:00
if [ -n "$OLDDIR" ]; then
cd $OLDDIR
fi