4 Commits
Author SHA1 Message Date
ValdikSS 68de91778e Check whether Win 7 bootmgfw.efi exists at all 2022-12-08 23:29:28 +03:00
ValdikSS 8cd1b02b9d Make sure to extract Win 7 bootloader from regular and multi-volume WIM file 2022-12-08 23:28:57 +03:00
ValdikSS 8dd14fc452 Use -e for file check in other places as well, just to be sure 2022-12-08 22:38:17 +03:00
ValdikSS 4abb52133f 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
2022-12-08 22:36:35 +03:00
+12 -8
View File
@@ -140,9 +140,9 @@ function get_dev_partition_num() {
}
function write_uefintfs() {
if [ -a "$dirpath/uefi-ntfs.img" ]; then
if [ -e "$dirpath/uefi-ntfs.img" ]; then
cat "$dirpath/uefi-ntfs.img" > "$1"
elif [ -a "/usr/share/windows2usb/uefi-ntfs.img" ]; then
elif [ -e "/usr/share/windows2usb/uefi-ntfs.img" ]; then
cat "/usr/share/windows2usb/uefi-ntfs.img" > "$1"
fi
}
@@ -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' '?/Windows/Boot/EFI/bootmgfw.efi'
umount "$2"
}
@@ -349,8 +349,12 @@ then
echo "${bold} == Extracting UEFI bootloader from install.wim ==${normal}"
mkdir -p "$partpath/efi/boot/" || true
extract_bootmgfw_from_installwim "$isopath" "$isomountpath" "$partpath"
mv "$partpath/efi/boot/bootmgfw.efi" "$partpath/efi/boot/bootx64.efi"
cp "$partpath/efi/boot/bootx64.efi" "$partpath/efi/boot/bootia32.efi"
if [ -e "$partpath/efi/boot/bootmgfw.efi" ]; then
mv "$partpath/efi/boot/bootmgfw.efi" "$partpath/efi/boot/bootx64.efi"
cp "$partpath/efi/boot/bootx64.efi" "$partpath/efi/boot/bootia32.efi"
else
echo "NOTE: your ISO file does not have UEFI bootloader, UEFI boot would be unavailable!"
fi
fi
echo "${bold} == Unmounting partition ==${normal}"