From 4abb52133f36d958e6b83d2f602e77b9cf65ccc0 Mon Sep 17 00:00:00 2001 From: ValdikSS Date: Thu, 8 Dec 2022 22:12:37 +0300 Subject: [PATCH] Fix install.wim existance check and extraction for Windows 7 Three bugs: * Bash [ -a ] and [ ! -a ] are two different operations: the first checks for file existance, the second is a binary AND operation. Replace it with -e, which is consistent. * Mount ISO before checking its contents * Ensure that we extract the latest version of the wim/esd file (7z always replace) Fixes #35 --- windows2usb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/windows2usb b/windows2usb index 7989973..483e64b 100755 --- a/windows2usb +++ b/windows2usb @@ -174,11 +174,11 @@ function extract_bootmgfw_from_installwim() { # $2 - isomountpath # $3 - destdir - local fpath="$2/sources/install.wim" - [ ! -a "$fpath" ] && fpath="$2/sources/install.esd" - mount -o ro "$1" "$2" - 7z e "$fpath" -o"$3/efi/boot/" '?/Windows/Boot/EFI/bootmgfw.efi' + local fpath="$2/sources/install.wim" + [ ! -e "$fpath" ] && fpath="$2/sources/install.esd" + + 7z e "$fpath" -aoa -o"$3/efi/boot/" '?/Windows/Boot/EFI/bootmgfw.efi' umount "$2" }