1 A shameless merge of many patches floating around; indeed it was made by reading
2 and applying them manually.
4 diff -Naur ventoy-1.0.81-old/CreatePersistentImg.sh ventoy-1.0.81-new/CreatePersistentImg.sh
5 --- ventoy-1.0.81-old/CreatePersistentImg.sh 2022-10-25 08:26:21.000000000 -0300
6 +++ ventoy-1.0.81-new/CreatePersistentImg.sh 2022-11-02 10:29:07.355891607 -0300
10 if [ -n "$config" ]; then
11 - if [ -d ./persist_tmp_mnt ]; then
12 - rm -rf ./persist_tmp_mnt
15 - mkdir ./persist_tmp_mnt
16 - if mount $freeloop ./persist_tmp_mnt; then
17 - echo '/ union' > ./persist_tmp_mnt/$config
18 + path_to_persist_mnt="`mktemp -d`"
19 + if mount $freeloop "$path_to_persist_mnt"; then
20 + echo '/ union' > "$path_to_persist_mnt"/$config
22 - umount ./persist_tmp_mnt
23 + umount "$path_to_persist_mnt"
25 - rm -rf ./persist_tmp_mnt
26 + rm -rf "$path_to_persist_mnt"
29 if [ ! -z "$passphrase" ]; then
30 diff -Naur ventoy-1.0.81-old/tool/ventoy_lib.sh ventoy-1.0.81-new/tool/ventoy_lib.sh
31 --- ventoy-1.0.81-old/tool/ventoy_lib.sh 2022-10-25 08:26:21.000000000 -0300
32 +++ ventoy-1.0.81-new/tool/ventoy_lib.sh 2022-11-02 09:46:29.764568349 -0300
34 VENTOY_SECTOR_SIZE=512
35 VENTOY_SECTOR_NUM=65536
37 +LOGFILE="/var/log/ventoy.log"
46 - echo "$*" >> ./log.txt
47 + echo "$*" >> $LOGFILE
54 check_tool_work_ok() {
56 - if echo 1 | hexdump > /dev/null; then
57 - vtdebug "hexdump test ok ..."
59 - vtdebug "hexdump test fail ..."
64 - if mkexfatfs -V > /dev/null; then
65 - vtdebug "mkexfatfs test ok ..."
67 - vtdebug "mkexfatfs test fail ..."
72 - if vtoycli fat -T; then
73 - vtdebug "vtoycli fat test ok ..."
75 - vtdebug "vtoycli fat test fail ..."
81 vtdebug "tool check success ..."
86 vtdebug "format disk by fdisk ..."
88 -fdisk $DISK >>./log.txt 2>&1 <<EOF
89 +fdisk $DISK >>$LOGFILE 2>&1 <<EOF
93 diff -Naur ventoy-1.0.81-old/tool/VentoyWorker.sh ventoy-1.0.81-new/tool/VentoyWorker.sh
94 --- ventoy-1.0.81-old/tool/VentoyWorker.sh 2022-10-25 08:26:21.000000000 -0300
95 +++ ventoy-1.0.81-new/tool/VentoyWorker.sh 2022-11-02 10:33:25.813135227 -0300
97 if check_tool_work_ok; then
98 vtdebug "check tool work ok"
100 - vterr "Some tools can not run on current system. Please check log.txt for details."
101 + vterr "Some tools can not run on current system. Please check $LOGFILE for details."
110 -#check tmp_mnt directory
111 -if [ -d ./tmp_mnt ]; then
112 - vtdebug "There is a tmp_mnt directory, now delete it."
113 - umount ./tmp_mnt >/dev/null 2>&1
115 - if [ -d ./tmp_mnt ]; then
116 - vterr "tmp_mnt directory exists, please delete it first."
122 if [ "$MODE" = "install" -a -z "$NONDESTRUCTIVE" ]; then
123 vtdebug "install Ventoy ..."
125 @@ -567,16 +554,16 @@
126 PART1_TYPE=$(dd if=$DISK bs=1 count=1 skip=450 status=none | hexdump -n1 -e '1/1 "%02X"')
129 - rm -f ./diskuuid.bin
130 - dd status=none conv=fsync if=${DISK} skip=384 bs=1 count=16 of=./diskuuid.bin
131 + path_to_diskuuid="`mktemp`"
132 + dd status=none conv=fsync if=${DISK} skip=384 bs=1 count=16 of="$path_to_diskuuid"
134 dd status=none conv=fsync if=./boot/boot.img of=$DISK bs=1 count=440
135 - dd status=none conv=fsync if=./diskuuid.bin of=$DISK bs=1 count=16 seek=384
136 - rm -f ./diskuuid.bin
137 + dd status=none conv=fsync if="$path_to_diskuuid" of=$DISK bs=1 count=16 seek=384
138 + rm -f "$path_to_diskuuid"
141 - rm -f ./rsvdata.bin
142 - dd status=none conv=fsync if=${DISK} skip=2040 bs=512 count=8 of=./rsvdata.bin
143 + path_to_rsvdata="`mktemp`"
144 + dd status=none conv=fsync if=${DISK} skip=2040 bs=512 count=8 of="$path_to_rsvdata"
146 if [ "$PART1_TYPE" = "EE" ]; then
147 vtdebug "This is GPT partition style ..."
149 xzcat ./boot/core.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=2047 seek=1
152 - dd status=none conv=fsync if=./rsvdata.bin seek=2040 bs=512 count=8 of=${DISK}
153 - rm -f ./rsvdata.bin
154 + dd status=none conv=fsync if="$path_to_rsvdata" seek=2040 bs=512 count=8 of=${DISK}
155 + rm -f "$path_to_rsvdata"
157 check_umount_disk "$DISK"
159 diff -Naur ventoy-1.0.81-old/Ventoy2Disk.sh ventoy-1.0.81-new/Ventoy2Disk.sh
160 --- ventoy-1.0.81-old/Ventoy2Disk.sh 2022-10-25 08:26:21.000000000 -0300
161 +++ ventoy-1.0.81-new/Ventoy2Disk.sh 2022-11-02 09:50:17.649369332 -0300
163 echo '**********************************************'
167 -if ! [ -f ./boot/boot.img ]; then
168 - if [ -d ./grub ]; then
169 - echo "Don't run Ventoy2Disk.sh here, please download the released install package, and run the script in it."
171 - echo "Please run under the correct directory!"
176 -echo "############# Ventoy2Disk $* [$TOOLDIR] ################" >> ./log.txt
180 -echo "decompress tools" >> ./log.txt
183 -ls *.xz > /dev/null 2>&1
184 -if [ $? -eq 0 ]; then
185 - [ -f ./xzcat ] && chmod +x ./xzcat
187 - for file in $(ls *.xz); do
188 - echo "decompress $file" >> ./log.txt
189 - xzcat $file > ${file%.xz}
190 - [ -f ./${file%.xz} ] && chmod +x ./${file%.xz}
191 - [ -f ./$file ] && rm -f ./$file
196 -chmod +x -R ./tool/$TOOLDIR
199 -if [ -f /bin/bash ]; then
200 - /bin/bash ./tool/VentoyWorker.sh $*
202 - ash ./tool/VentoyWorker.sh $*
205 -if [ -n "$OLDDIR" ]; then
207 - if [ "$CURDIR" != "$OLDDIR" ]; then
211 +./tool/VentoyWorker.sh $*
212 diff -Naur ventoy-1.0.81-old/VentoyPlugson.sh ventoy-1.0.81-new/VentoyPlugson.sh
213 --- ventoy-1.0.81-old/VentoyPlugson.sh 2022-10-25 08:26:21.000000000 -0300
214 +++ ventoy-1.0.81-new/VentoyPlugson.sh 2022-11-02 09:51:36.758360872 -0300
220 -if ! [ -f "$OLDDIR/tool/plugson.tar.xz" ]; then
221 - echo "Please run under the correct directory!"
225 -echo "############# VentoyPlugson $* [$TOOLDIR] ################" >> ./VentoyPlugson.log
226 -date >> ./VentoyPlugson.log
228 -echo "decompress tools" >> ./VentoyPlugson.log
231 -ls *.xz > /dev/null 2>&1
232 -if [ $? -eq 0 ]; then
233 - [ -f ./xzcat ] && chmod +x ./xzcat
235 - for file in $(ls *.xz); do
236 - echo "decompress $file" >> ./VentoyPlugson.log
237 - xzcat $file > ${file%.xz}
238 - [ -f ./${file%.xz} ] && chmod +x ./${file%.xz}
239 - [ -f ./$file ] && rm -f ./$file
244 -chmod +x -R ./tool/$TOOLDIR
246 -if ! [ -f "$OLDDIR/tool/$TOOLDIR/Plugson" ]; then
247 - echo "$OLDDIR/tool/$TOOLDIR/Plugson does not exist!"
252 PATH=./tool/$TOOLDIR:$PATH
261 -if [ -n "$OLDDIR" ]; then
263 - if [ "$CURDIR" != "$OLDDIR" ]; then
267 diff -Naur ventoy-1.0.81-old/VentoyWeb.sh ventoy-1.0.81-new/VentoyWeb.sh
268 --- ventoy-1.0.81-old/VentoyWeb.sh 2022-10-25 08:26:21.000000000 -0300
269 +++ ventoy-1.0.81-new/VentoyWeb.sh 2022-11-02 09:53:13.773791254 -0300
275 -if [ $uid -ne 0 ]; then
276 - print_err "Please use sudo or run the script as root."
282 if uname -m | egrep -q 'aarch64|arm64'; then
288 -#delete the log.txt if it's more than 8MB
289 +LOGFILE=/var/log/ventoy.log
290 +#delete the logfile if it's more than 8MB
291 if [ -f $LOGFILE ]; then
292 logsize=$(stat -c '%s' $LOGFILE)
293 if [ $logsize -gt 8388608 ]; then
299 if [ -f ./tool/$TOOLDIR/V2DServer.xz ]; then
300 xz -d ./tool/$TOOLDIR/V2DServer.xz
301 chmod +x ./tool/$TOOLDIR/V2DServer