]> glassweightruler.freedombox.rocks Git - Ventoy.git/blob - INSTALL/Ventoy2Disk.sh
misc update
[Ventoy.git] / INSTALL / Ventoy2Disk.sh
1 #!/bin/sh
2
3 OLDDIR=$(pwd)
4
5 if ! [ -f ./tool/ventoy_lib.sh ]; then
6 if [ -f ${0%Ventoy2Disk.sh}/tool/ventoy_lib.sh ]; then
7 cd ${0%Ventoy2Disk.sh}
8 fi
9 fi
10
11 if [ -f ./ventoy/version ]; then
12 curver=$(cat ./ventoy/version)
13 fi
14
15 if uname -a | egrep -q 'aarch64|arm64'; then
16 export TOOLDIR=aarch64
17 elif uname -a | egrep -q 'x86_64|amd64'; then
18 export TOOLDIR=x86_64
19 else
20 export TOOLDIR=i386
21 fi
22 export PATH=./tool/$TOOLDIR:$PATH
23
24
25 echo ''
26 echo '**********************************************'
27 echo " Ventoy: $curver $TOOLDIR"
28 echo " longpanda admin@ventoy.net"
29 echo " https://www.ventoy.net"
30 echo '**********************************************'
31 echo ''
32
33
34 if ! [ -f ./boot/boot.img ]; then
35 if [ -d ./grub ]; then
36 echo "Don't run Ventoy2Disk.sh here, please download the released install package, and run the script in it."
37 else
38 echo "Please run under the correct directory!"
39 fi
40 exit 1
41 fi
42
43 echo "############# Ventoy2Disk $* [$TOOLDIR] ################" >> ./log.txt
44 date >> ./log.txt
45
46 #decompress tool
47 if [ -f ./tool/$TOOLDIR/ash ]; then
48 echo "no need to decompress tools" >> ./log.txt
49 else
50 cd ./tool/$TOOLDIR
51
52 [ -f ./xzcat ] && chmod +x ./xzcat
53
54 for file in $(ls *.xz); do
55 xzcat $file > ${file%.xz}
56 [ -f ./${file%.xz} ] && chmod +x ./${file%.xz}
57 [ -f ./$file ] && rm -f ./$file
58 done
59 cd ../../
60
61 chmod +x -R ./tool/$TOOLDIR
62 fi
63
64 if [ -f /bin/bash ]; then
65 /bin/bash ./tool/VentoyWorker.sh $*
66 else
67 ash ./tool/VentoyWorker.sh $*
68 fi
69
70 if [ -n "$OLDDIR" ]; then
71 CURDIR=$(pwd)
72 if [ "$CURDIR" != "$OLDDIR" ]; then
73 cd "$OLDDIR"
74 fi
75 fi