]> glassweightruler.freedombox.rocks Git - Ventoy.git/blobdiff - INSTALL/Ventoy2Disk.sh
1.1.07 release
[Ventoy.git] / INSTALL / Ventoy2Disk.sh
index f45bec82e262de977de77844f872da68b704ab31..f08ab1090a26d040af9a09db88b283e00eb09c62 100644 (file)
@@ -1,5 +1,7 @@
 #!/bin/sh
 
 #!/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}    
 if ! [ -f ./tool/ventoy_lib.sh ]; then
     if [ -f ${0%Ventoy2Disk.sh}/tool/ventoy_lib.sh ]; then
         cd ${0%Ventoy2Disk.sh}    
@@ -10,16 +12,16 @@ if [ -f ./ventoy/version ]; then
     curver=$(cat ./ventoy/version) 
 fi
 
     curver=$(cat ./ventoy/version) 
 fi
 
-OLDDIR=$(pwd)
-
-if uname -a | egrep -q 'aarch64|arm64'; then
+if uname -m | grep -E -q 'aarch64|arm64'; then
     export TOOLDIR=aarch64
     export TOOLDIR=aarch64
-elif uname -a | egrep -q 'x86_64|amd64'; then
+elif uname -m | grep -E -q 'x86_64|amd64'; then
     export TOOLDIR=x86_64
     export TOOLDIR=x86_64
+elif uname -m | grep -E -q 'mips64'; then
+    export TOOLDIR=mips64el
 else
     export TOOLDIR=i386
 fi
 else
     export TOOLDIR=i386
 fi
-export PATH=./tool/$TOOLDIR:$PATH
+export PATH="./tool/$TOOLDIR:$PATH"
 
 
 echo ''
 
 
 echo ''
@@ -44,22 +46,25 @@ echo "############# Ventoy2Disk $* [$TOOLDIR] ################" >> ./log.txt
 date >> ./log.txt
 
 #decompress tool
 date >> ./log.txt
 
 #decompress tool
-if [ -f ./tool/$TOOLDIR/ash ]; then
-    echo "no need to decompress tools" >> ./log.txt
-else
-    cd ./tool/$TOOLDIR
-    
+echo "decompress tools" >> ./log.txt
+cd ./tool/$TOOLDIR
+
+ls *.xz > /dev/null 2>&1
+if [ $? -eq 0 ]; then
     [ -f ./xzcat ] && chmod +x ./xzcat
     [ -f ./xzcat ] && chmod +x ./xzcat
-    
+
     for file in $(ls *.xz); do
     for file in $(ls *.xz); do
+        echo "decompress $file" >> ./log.txt
         xzcat $file > ${file%.xz}
         xzcat $file > ${file%.xz}
+        [ -f ./${file%.xz} ] && chmod +x ./${file%.xz}
         [ -f ./$file ] && rm -f ./$file
     done
         [ -f ./$file ] && rm -f ./$file
     done
-    cd $OLDDIR
-    
-    chmod +x -R ./tool/$TOOLDIR
 fi
 
 fi
 
+cd ../../
+chmod +x -R ./tool/$TOOLDIR
+
+
 if [ -f /bin/bash ]; then
     /bin/bash ./tool/VentoyWorker.sh $*
 else
 if [ -f /bin/bash ]; then
     /bin/bash ./tool/VentoyWorker.sh $*
 else
@@ -67,7 +72,8 @@ else
 fi
 
 if [ -n "$OLDDIR" ]; then 
 fi
 
 if [ -n "$OLDDIR" ]; then 
-    cd $OLDDIR
+    CURDIR=$(pwd)
+    if [ "$CURDIR" != "$OLDDIR" ]; then
+        cd "$OLDDIR"
+    fi
 fi
 fi
-
-