2020-04-04 12:07:50 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
|
|
|
|
echo ''
|
|
|
|
echo '***********************************************************'
|
|
|
|
echo '* Ventoy2Disk Script *'
|
|
|
|
echo '* longpanda admin@ventoy.net *'
|
|
|
|
echo '***********************************************************'
|
|
|
|
echo ''
|
|
|
|
|
2020-05-29 10:57:40 -04:00
|
|
|
OLDDIR=$PWD
|
2020-04-04 12:07:50 -04:00
|
|
|
|
2020-05-29 10:57:40 -04:00
|
|
|
if ! [ -f ./tool/xzcat ]; then
|
|
|
|
if [ -f ${0%Ventoy2Disk.sh}/tool/xzcat ]; then
|
|
|
|
cd ${0%Ventoy2Disk.sh}
|
2020-05-04 11:46:51 -04:00
|
|
|
fi
|
2020-05-16 02:17:36 -04:00
|
|
|
fi
|
|
|
|
|
2020-04-30 10:40:40 -04:00
|
|
|
if ! [ -f ./boot/boot.img ]; then
|
|
|
|
if [ -d ./grub ]; then
|
2020-05-29 10:57:40 -04:00
|
|
|
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
|
2020-05-29 10:57:40 -04:00
|
|
|
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-05-29 10:57:40 -04:00
|
|
|
echo "############# Ventoy2Disk $* ################" >> ./log.txt
|
2020-04-24 09:58:00 -04:00
|
|
|
|
2020-05-29 10:57:40 -04:00
|
|
|
#decompress tool
|
|
|
|
if ! [ -f ./tool/ash ]; then
|
|
|
|
cd tool
|
|
|
|
chmod +x ./xzcat
|
|
|
|
for file in $(ls *.xz); do
|
|
|
|
./xzcat $file > ${file%.xz}
|
|
|
|
chmod +x ${file%.xz}
|
2020-05-23 09:19:26 -04:00
|
|
|
done
|
2020-05-29 10:57:40 -04:00
|
|
|
cd ../
|
2020-04-04 12:07:50 -04:00
|
|
|
|
2020-05-29 10:57:40 -04:00
|
|
|
if ! [ -f ./tool/ash ]; then
|
|
|
|
echo 'Failed to decompress tools ...'
|
2020-04-24 09:58:00 -04:00
|
|
|
cd $OLDDIR
|
2020-04-04 12:07:50 -04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2020-05-29 10:57:40 -04:00
|
|
|
./tool/ash ./tool/VentoyWorker.sh $*
|
|
|
|
|
2020-04-24 09:58:00 -04:00
|
|
|
cd $OLDDIR
|
2020-05-29 10:57:40 -04:00
|
|
|
|