X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/Ventoy.git/blobdiff_plain/9a8d4d0227f2ac11ca5bd7c826c1d9761d0f5bd5..e763d7590f830dc59aaa0c9dab8d6a3c0867944f:/INSTALL/Ventoy2Disk.sh diff --git a/INSTALL/Ventoy2Disk.sh b/INSTALL/Ventoy2Disk.sh index 7947360..d8440d0 100644 --- a/INSTALL/Ventoy2Disk.sh +++ b/INSTALL/Ventoy2Disk.sh @@ -1,24 +1,37 @@ #!/bin/sh +OLDDIR=$(pwd) + +if ! [ -f ./tool/ventoy_lib.sh ]; then + if [ -f ${0%Ventoy2Disk.sh}/tool/ventoy_lib.sh ]; then + cd ${0%Ventoy2Disk.sh} + fi +fi + if [ -f ./ventoy/version ]; then curver=$(cat ./ventoy/version) fi +if uname -m | egrep -q 'aarch64|arm64'; then + export TOOLDIR=aarch64 +elif uname -m | egrep -q 'x86_64|amd64'; then + export TOOLDIR=x86_64 +elif uname -m | egrep -q 'mips64'; then + export TOOLDIR=mips64el +else + export TOOLDIR=i386 +fi +export PATH="./tool/$TOOLDIR:$PATH" + + echo '' echo '**********************************************' -echo " Ventoy: $curver" +echo " Ventoy: $curver $TOOLDIR" echo " longpanda admin@ventoy.net" echo " https://www.ventoy.net" echo '**********************************************' echo '' -OLDDIR=$PWD - -if ! [ -f ./tool/xzcat ]; then - if [ -f ${0%Ventoy2Disk.sh}/tool/xzcat ]; then - cd ${0%Ventoy2Disk.sh} - fi -fi if ! [ -f ./boot/boot.img ]; then if [ -d ./grub ]; then @@ -29,31 +42,36 @@ if ! [ -f ./boot/boot.img ]; then exit 1 fi -echo "############# Ventoy2Disk $* ################" >> ./log.txt +echo "############# Ventoy2Disk $* [$TOOLDIR] ################" >> ./log.txt +date >> ./log.txt #decompress tool -if ! [ -f ./tool/ash ]; then - cd tool - chmod +x ./xzcat +if [ -f ./tool/$TOOLDIR/ash ]; then + echo "no need to decompress tools" >> ./log.txt +else + cd ./tool/$TOOLDIR + + [ -f ./xzcat ] && chmod +x ./xzcat + for file in $(ls *.xz); do - ./xzcat $file > ${file%.xz} - chmod +x ${file%.xz} + xzcat $file > ${file%.xz} + [ -f ./${file%.xz} ] && chmod +x ./${file%.xz} + [ -f ./$file ] && rm -f ./$file done - cd ../ - - if ! [ -f ./tool/ash ]; then - echo 'Failed to decompress tools ...' - if [ -n "$OLDDIR" ]; then - cd $OLDDIR - fi - exit 1 - fi + cd ../../ + + chmod +x -R ./tool/$TOOLDIR fi -./tool/ash ./tool/VentoyWorker.sh $* +if [ -f /bin/bash ]; then + /bin/bash ./tool/VentoyWorker.sh $* +else + ash ./tool/VentoyWorker.sh $* +fi if [ -n "$OLDDIR" ]; then - cd $OLDDIR + CURDIR=$(pwd) + if [ "$CURDIR" != "$OLDDIR" ]; then + cd "$OLDDIR" + fi fi - -