]> glassweightruler.freedombox.rocks Git - Ventoy.git/blob - INSTALL/Ventoy2Disk.sh
DragonFly BSD support
[Ventoy.git] / INSTALL / Ventoy2Disk.sh
1 #!/bin/sh
2
3 if ! [ -f ./tool/ventoy_lib.sh ]; then
4 if [ -f ${0%Ventoy2Disk.sh}/tool/ventoy_lib.sh ]; then
5 cd ${0%Ventoy2Disk.sh}
6 fi
7 fi
8
9 if [ -f ./ventoy/version ]; then
10 curver=$(cat ./ventoy/version)
11 fi
12
13 OLDDIR=$(pwd)
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 ] && rm -f ./$file
57 done
58 cd $OLDDIR
59
60 chmod +x -R ./tool/$TOOLDIR
61 fi
62
63 if [ -f /bin/bash ]; then
64 /bin/bash ./tool/VentoyWorker.sh $*
65 else
66 ash ./tool/VentoyWorker.sh $*
67 fi
68
69 if [ -n "$OLDDIR" ]; then
70 cd $OLDDIR
71 fi
72
73