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