nixpkgs/pkgs/tools/cd-dvd/ventoy-bin/fix-for-read-only-file-system.patch
2021-08-27 23:33:30 +03:00

118 lines
5.4 KiB
Diff

diff -Naurp0 old/CreatePersistentImg.sh new/CreatePersistentImg.sh
--- CreatePersistentImg.sh 2021-07-17 13:13:51.000000000 +0300
+++ CreatePersistentImg.sh 2021-07-20 17:37:53.605911754 +0300
@@ -94,7 +94,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
@@ -102 +98 @@ if [ -n "$config" ]; then
- umount ./persist_tmp_mnt
+ umount "$path_to_persist_mnt"
@@ -104 +100 @@ if [ -n "$config" ]; then
- rm -rf ./persist_tmp_mnt
+ rm -rf "$path_to_persist_mnt"
diff -Naurp0 old/tool/VentoyWorker.sh new/tool/VentoyWorker.sh
--- tool/VentoyWorker.sh 2021-07-17 13:13:51.000000000 +0300
+++ tool/VentoyWorker.sh 2021-07-20 17:27:10.885452119 +0300
@@ -153,12 +152,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 exits, please delete it first."
- exit 1
- fi
-fi
-
-
@@ -322 +310 @@ if [ "$MODE" = "install" ]; then
- mkdir ./tmp_mnt
+ path_to_mnt="$(mktemp -d)"
@@ -326 +314 @@ if [ "$MODE" = "install" ]; then
- if mount ${PART2} ./tmp_mnt > /dev/null 2>&1; then
+ if mount ${PART2} "$path_to_mnt" > /dev/null 2>&1; then
@@ -335,9 +323,9 @@ if [ "$MODE" = "install" ]; then
- rm -f ./tmp_mnt/EFI/BOOT/BOOTX64.EFI
- rm -f ./tmp_mnt/EFI/BOOT/grubx64.efi
- rm -f ./tmp_mnt/EFI/BOOT/BOOTIA32.EFI
- rm -f ./tmp_mnt/EFI/BOOT/grubia32.efi
- rm -f ./tmp_mnt/EFI/BOOT/MokManager.efi
- rm -f ./tmp_mnt/EFI/BOOT/mmia32.efi
- rm -f ./tmp_mnt/ENROLL_THIS_KEY_IN_MOKMANAGER.cer
- mv ./tmp_mnt/EFI/BOOT/grubx64_real.efi ./tmp_mnt/EFI/BOOT/BOOTX64.EFI
- mv ./tmp_mnt/EFI/BOOT/grubia32_real.efi ./tmp_mnt/EFI/BOOT/BOOTIA32.EFI
+ rm -f "$path_to_mnt"/EFI/BOOT/BOOTX64.EFI
+ rm -f "$path_to_mnt"/EFI/BOOT/grubx64.efi
+ rm -f "$path_to_mnt"/EFI/BOOT/BOOTIA32.EFI
+ rm -f "$path_to_mnt"/EFI/BOOT/grubia32.efi
+ rm -f "$path_to_mnt"/EFI/BOOT/MokManager.efi
+ rm -f "$path_to_mnt"/EFI/BOOT/mmia32.efi
+ rm -f "$path_to_mnt"/ENROLL_THIS_KEY_IN_MOKMANAGER.cer
+ mv "$path_to_mnt"/EFI/BOOT/grubx64_real.efi "$path_to_mnt"/EFI/BOOT/BOOTX64.EFI
+ mv "$path_to_mnt"/EFI/BOOT/grubia32_real.efi "$path_to_mnt"/EFI/BOOT/BOOTIA32.EFI
@@ -348 +336 @@ if [ "$MODE" = "install" ]; then
- if umount ./tmp_mnt; then
+ if umount "$path_to_mnt"; then
@@ -350 +338 @@ if [ "$MODE" = "install" ]; then
- rm -rf ./tmp_mnt
+ rm -rf "$path_to_mnt"
@@ -407,2 +395,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"
@@ -411,2 +399,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"
@@ -415,2 +403,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"
@@ -438,2 +426,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"
@@ -448 +436 @@ else
- mkdir ./tmp_mnt
+ path_to_mnt="$(mktemp -d)"
@@ -454 +442 @@ else
- if mount ${PART2} ./tmp_mnt > /dev/null 2>&1; then
+ if mount ${PART2} "$path_to_mnt" > /dev/null 2>&1; then
@@ -463,9 +451,9 @@ else
- rm -f ./tmp_mnt/EFI/BOOT/BOOTX64.EFI
- rm -f ./tmp_mnt/EFI/BOOT/grubx64.efi
- rm -f ./tmp_mnt/EFI/BOOT/BOOTIA32.EFI
- rm -f ./tmp_mnt/EFI/BOOT/grubia32.efi
- rm -f ./tmp_mnt/EFI/BOOT/MokManager.efi
- rm -f ./tmp_mnt/EFI/BOOT/mmia32.efi
- rm -f ./tmp_mnt/ENROLL_THIS_KEY_IN_MOKMANAGER.cer
- mv ./tmp_mnt/EFI/BOOT/grubx64_real.efi ./tmp_mnt/EFI/BOOT/BOOTX64.EFI
- mv ./tmp_mnt/EFI/BOOT/grubia32_real.efi ./tmp_mnt/EFI/BOOT/BOOTIA32.EFI
+ rm -f "$path_to_mnt"/EFI/BOOT/BOOTX64.EFI
+ rm -f "$path_to_mnt"/EFI/BOOT/grubx64.efi
+ rm -f "$path_to_mnt"/EFI/BOOT/BOOTIA32.EFI
+ rm -f "$path_to_mnt"/EFI/BOOT/grubia32.efi
+ rm -f "$path_to_mnt"/EFI/BOOT/MokManager.efi
+ rm -f "$path_to_mnt"/EFI/BOOT/mmia32.efi
+ rm -f "$path_to_mnt"/ENROLL_THIS_KEY_IN_MOKMANAGER.cer
+ mv "$path_to_mnt"/EFI/BOOT/grubx64_real.efi "$path_to_mnt"/EFI/BOOT/BOOTX64.EFI
+ mv "$path_to_mnt"/EFI/BOOT/grubia32_real.efi "$path_to_mnt"/EFI/BOOT/BOOTIA32.EFI
@@ -476 +464 @@ else
- if umount ./tmp_mnt > /dev/null 2>&1; then
+ if umount "$path_to_mnt" > /dev/null 2>&1; then
@@ -478 +466 @@ else
- rm -rf ./tmp_mnt
+ rm -rf "$path_to_mnt"