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