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