From 108a09c34142bee0b8d32b156bb8cf603c7d55f5 Mon Sep 17 00:00:00 2001 From: Davide Depau Date: Sat, 11 May 2019 21:29:28 +0200 Subject: [PATCH 1/2] Add ability to automatically split install.wim if needed --- debian/control | 1 + src/woeusb | 29 ++++++++++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/debian/control b/debian/control index 32c301a..95d1a46 100644 --- a/debian/control +++ b/debian/control @@ -25,6 +25,7 @@ Depends: bash (>=4.3), policykit-1, realpath | coreutils (>= 8.23), wget, + wimtools, ${misc:Depends}, ${shlibs:Depends} Description: Bootable Windows installation/PE USB storage creator diff --git a/src/woeusb b/src/woeusb index 3284259..ae8fd7b 100755 --- a/src/woeusb +++ b/src/woeusb @@ -1205,6 +1205,12 @@ check_fat32_filesize_limitation(){ while IFS= read -r -d '' file; do if (( "$(stat -c '%s' "${file}")" > 4294967295 )); then # Max fat32 file size is 2^32 - 1 bytes + if [[ "${file}" == */install.wim ]]; then + printf_with_color \ + yellow \ + 'Detected large "install.wim", will try to split it in multiple chunks\n' + continue + fi printf_with_color \ red \ 'Error: File "%s" in source image has exceed the FAT32 Filesystem 4GiB Single File Size Limitation and cannot be installed. You must specify a different --target-filesystem.\n' \ @@ -1457,15 +1463,20 @@ copy_filesystem_files(){ if [ "${verbose}" = true ]; then echo -e "\\nINFO: Copying \"${source_file}\"..." fi - if [ "${source_file_size}" -lt "${DD_BLOCK_SIZE}" ]; then - cp "${source_file}" "${dest_file}" - else - copy_large_file \ - "${source_file}" \ - "${dest_file}" \ - "${copied_size}" \ - "${total_size}" - fi + if [[ "${source_file}" == */install.wim ]]; then + echo -e "\\nSplitting large install.wim image" + wimsplit "${source_file}" "$(echo "${dest_file}" | sed 's/install.wim$/install.swm/g')" 3800 + else + if [ "${source_file_size}" -lt "${DD_BLOCK_SIZE}" ]; then + cp "${source_file}" "${dest_file}" + else + copy_large_file \ + "${source_file}" \ + "${dest_file}" \ + "${copied_size}" \ + "${total_size}" + fi + fi else echo_with_color red "${FUNCNAME[0]}: Error: Unknown type of '${source_file}'!" >&2 exit 1 From 6755698f3216430bbb16dc319a79788feb571d77 Mon Sep 17 00:00:00 2001 From: Davide Depau Date: Sat, 11 May 2019 21:40:59 +0200 Subject: [PATCH 2/2] Only split the image if it's too large --- src/woeusb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/woeusb b/src/woeusb index ae8fd7b..fb4fad2 100755 --- a/src/woeusb +++ b/src/woeusb @@ -1463,7 +1463,7 @@ copy_filesystem_files(){ if [ "${verbose}" = true ]; then echo -e "\\nINFO: Copying \"${source_file}\"..." fi - if [[ "${source_file}" == */install.wim ]]; then + if [ "$source_file_size" -gt 4294967295 ] && [[ "${source_file}" == */install.wim ]]; then echo -e "\\nSplitting large install.wim image" wimsplit "${source_file}" "$(echo "${dest_file}" | sed 's/install.wim$/install.swm/g')" 3800 else