]> glassweightruler.freedombox.rocks Git - Ventoy.git/blobdiff - INSTALL/Ventoy2Disk.sh
added Spanish (Latinoamérica) translation (#1865)
[Ventoy.git] / INSTALL / Ventoy2Disk.sh
index 7a5415fad37fe70bef53607e2ef8e3cb808f9001..dac5c2f5a58a42da25b5d0516d878fa5038f335c 100644 (file)
@@ -1,5 +1,7 @@
 #!/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}    
@@ -10,16 +12,26 @@ 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)
-PATH=./tool:$PATH
 
 if ! [ -f ./boot/boot.img ]; then
     if [ -d ./grub ]; then
@@ -30,34 +42,38 @@ 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/VentoyWorker.sh ]; then
-    echo "no need to decompress tools" >> ./log.txt
-else
-    cd tool
-    
-    if [ -f ./xzcat ]; then
-        chmod +x ./xzcat
-    fi
-    
+echo "decompress tools" >> ./log.txt
+cd ./tool/$TOOLDIR
+
+ls *.xz > /dev/null 2>&1
+if [ $? -eq 0 ]; then
+    [ -f ./xzcat ] && chmod +x ./xzcat
+
     for file in $(ls *.xz); do
+        echo "decompress $file" >> ./log.txt
         xzcat $file > ${file%.xz}
-        chmod +x ${file%.xz}
+        [ -f ./${file%.xz} ] && chmod +x ./${file%.xz}
+        [ -f ./$file ] && rm -f ./$file
     done
-    cd ../
 fi
 
+cd ../../
+chmod +x -R ./tool/$TOOLDIR
+
+
 if [ -f /bin/bash ]; then
-    bash ./tool/VentoyWorker.sh $*
+    /bin/bash ./tool/VentoyWorker.sh $*
 else
-    ./tool/ash ./tool/VentoyWorker.sh $*
+    ash ./tool/VentoyWorker.sh $*
 fi
 
 if [ -n "$OLDDIR" ]; then 
-    cd $OLDDIR
+    CURDIR=$(pwd)
+    if [ "$CURDIR" != "$OLDDIR" ]; then
+        cd "$OLDDIR"
+    fi
 fi
-
-