nixpkgs/pkgs/tools/cd-dvd/ventoy-bin/fix-for-read-only-file-system.patch
2022-03-28 17:44:11 +03:00

55 lines
2.0 KiB
Diff

--- CreatePersistentImg.sh
+++ CreatePersistentImg.sh
@@ -110,7 +110,3 @@ if [ -n "$config" ]; then
- if [ -d ./persist_tmp_mnt ]; then
- rm -rf ./persist_tmp_mnt
- fi
-
- mkdir ./persist_tmp_mnt
- if mount $freeloop ./persist_tmp_mnt; then
- echo '/ union' > ./persist_tmp_mnt/$config
+ path_to_persist_mnt="`mktemp -d`"
+ if mount $freeloop "$path_to_persist_mnt"; then
+ echo '/ union' > "$path_to_persist_mnt"/$config
@@ -118 +114 @@ if [ -n "$config" ]; then
- umount ./persist_tmp_mnt
+ umount "$path_to_persist_mnt"
@@ -120 +116 @@ if [ -n "$config" ]; then
- rm -rf ./persist_tmp_mnt
+ rm -rf "$path_to_persist_mnt"
--- tool/VentoyWorker.sh
+++ tool/VentoyWorker.sh
@@ -162,12 +161,0 @@ fi
-#check tmp_mnt directory
-if [ -d ./tmp_mnt ]; then
- vtdebug "There is a tmp_mnt directory, now delete it."
- umount ./tmp_mnt >/dev/null 2>&1
- rm -rf ./tmp_mnt
- if [ -d ./tmp_mnt ]; then
- vterr "tmp_mnt directory exists, please delete it first."
- exit 1
- fi
-fi
-
-
@@ -569,2 +557,2 @@ else
- rm -f ./diskuuid.bin
- dd status=none conv=fsync if=${DISK} skip=384 bs=1 count=16 of=./diskuuid.bin
+ path_to_diskuuid="`mktemp`"
+ dd status=none conv=fsync if=${DISK} skip=384 bs=1 count=16 of="$path_to_diskuuid"
@@ -573,2 +561,2 @@ else
- dd status=none conv=fsync if=./diskuuid.bin of=$DISK bs=1 count=16 seek=384
- rm -f ./diskuuid.bin
+ dd status=none conv=fsync if="$path_to_diskuuid" of=$DISK bs=1 count=16 seek=384
+ rm -f "$path_to_diskuuid"
@@ -577,2 +565,2 @@ else
- rm -f ./rsvdata.bin
- dd status=none conv=fsync if=${DISK} skip=2040 bs=512 count=8 of=./rsvdata.bin
+ path_to_rsvdata="`mktemp`"
+ dd status=none conv=fsync if=${DISK} skip=2040 bs=512 count=8 of="$path_to_rsvdata"
@@ -600,2 +588,2 @@ else
- dd status=none conv=fsync if=./rsvdata.bin seek=2040 bs=512 count=8 of=${DISK}
- rm -f ./rsvdata.bin
+ dd status=none conv=fsync if="$path_to_rsvdata" seek=2040 bs=512 count=8 of=${DISK}
+ rm -f "$path_to_rsvdata"