Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
68de91778e | ||
|
|
8cd1b02b9d | ||
|
|
8dd14fc452 | ||
|
|
4abb52133f | ||
|
|
964443265f | ||
|
|
6249a7fc98 | ||
|
|
1de605529a | ||
|
|
2a8287455e | ||
|
|
5aab680e8f |
@@ -36,7 +36,8 @@ gptntfs mode: all the same as 'gpt' but NTFS is used.
|
||||
|
||||
gpt+uefintfs mode: alternative hacky installation method, not recommended.
|
||||
This mode uses NTFS partition and third-party 'uefintfs' bootloader.
|
||||
GPT+NTFS(data)+FAT32(efi), UEFI only, NO Secure Boot support.
|
||||
GPT+NTFS(data)+FAT32(efi), UEFI only, supports Secure Boot
|
||||
(since uefintfs Oct 23, 2021 release).
|
||||
Large install.wim file will not be split.
|
||||
```
|
||||
|
||||
@@ -61,7 +62,7 @@ If you don't want to use AppImage, you'll need to install all dependencies and d
|
||||
|mbr(hybrid) |Supported |Supported|Supported |Supported |FAT32 |MBR |
|
||||
|gpt |No |Supported|Supported |Supported |FAT32 |GPT |
|
||||
|gptntfs |No |Partial |Supported |Supported |NTFS |GPT |
|
||||
|gpt+uefintfs|No |Supported|Supported |No |NTFS |GPT |
|
||||
|gpt+uefintfs|No |Supported|Supported |Supported |NTFS |GPT |
|
||||
|
||||
### BIOS Boot
|
||||
|
||||
@@ -89,7 +90,7 @@ A special 'gpt+uefintfs' mode uses [uefi-ntfs](https://github.com/pbatard/uefi-n
|
||||
|
||||
This mode was included earlier to work with installation disks where install.wim file is greater than 4 GiB, but since then split WIM file functionality was introduced, and now this mode may be considered obsolete.
|
||||
|
||||
This mode does not support Secure Boot (uefi-ntfs bootloader is not signed by Microsoft or other trusted party).
|
||||
uefi-ntfs bootloader is signed by Microsoft since Oct 23, 2021 release and supports Secure Boot.
|
||||
|
||||
## Alternatives
|
||||
|
||||
@@ -106,3 +107,4 @@ This script uses:
|
||||
* [**p7zip**](https://www.7-zip.org/) for ISO extraction
|
||||
* [**autofsync**](https://github.com/i-rinat/autofsync/) to prevent filesystem bufferbloat and properly show copying progress (AppImage only)
|
||||
* [**wimlib**](https://wimlib.net/) to split large install.wim files to fit FAT32 partition
|
||||
* [**uefi-ntfs**](https://github.com/pbatard/uefi-ntfs/)
|
||||
|
||||
+38
-10
@@ -6,14 +6,27 @@ shopt -s nocasematch # for "if labeltype"
|
||||
|
||||
export LANG=C.utf8
|
||||
|
||||
header='
|
||||
| __ _____ _ _ ____ _ _ ____ ____ |
|
||||
| \ \ / /_ _| \ | | |___ \ | | | / ___|| __ ) |
|
||||
| \ \ /\ / / | || \| | __) | | | | \___ \| _ \ |
|
||||
| \ V V / | || |\ | / __/ | |_| |___) | |_) | |
|
||||
| \_/\_/ |___|_| \_(_) |_____| \___/|____/|____/ |
|
||||
========================================================
|
||||
. Windows 7+ ISO to Flash Drive burning utility .'
|
||||
|
||||
bold="$(tput bold)"
|
||||
normal="$(tput sgr0)"
|
||||
blink="$(tput blink)"
|
||||
red="$(tput setaf 1)"
|
||||
smso="$(tput smso)"
|
||||
rmso="$(tput rmso)"
|
||||
scriptpath="$(readlink -f -- "$0")"
|
||||
dirpath="$(dirname "$scriptpath")"
|
||||
|
||||
|
||||
function check_requirements() {
|
||||
local reqs=(awk lsblk 7z mkfs.vfat mkfs.ntfs sfdisk ms-sys mktemp wimsplit)
|
||||
local reqs=(awk lsblk 7z mkfs.vfat mkfs.ntfs sfdisk ms-sys mktemp wimsplit tr)
|
||||
|
||||
for req in ${reqs[*]}; do
|
||||
if ! command -v "$req" > /dev/null;
|
||||
@@ -63,6 +76,12 @@ function get_iso_name() {
|
||||
7z l "$1" | awk '/Comment = / {print $3; exit 0}'
|
||||
}
|
||||
|
||||
function sanitize_iso_name() {
|
||||
# FAT32 does not allow certain characters in names, see
|
||||
# https://github.com/dosfstools/dosfstools/blob/1da41f0e70dcbfb874e8191c639b91fa58205ea4/src/fatlabel.c#L96
|
||||
echo "$1" | tr -d '*?.,;:/\\|+=<>[]"'
|
||||
}
|
||||
|
||||
function check_installwim_gt4gib() {
|
||||
7z l "$1" | awk 'BEGIN {doend=1} ($6 ~ /install.wim/) {if ($4 > 4294967296) {doend=0; exit 0}; doend=0; exit 1} END {if (doend) {exit 1}}'
|
||||
}
|
||||
@@ -121,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
|
||||
}
|
||||
@@ -155,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"
|
||||
}
|
||||
|
||||
@@ -181,8 +200,8 @@ function sigint_handler() {
|
||||
|
||||
if [[ ! "$2" ]];
|
||||
then
|
||||
echo "${bold}Windows 7/8/8.1/10/11 ISO to Flash Drive burning utility"
|
||||
echo "WARNING: this program will delete all existing data on your drive!${normal}"
|
||||
echo "${bold}${smso}${header}${rmso}"
|
||||
echo "${blink}${red}WARNING: this program will delete all existing data on your drive!${normal}"
|
||||
echo
|
||||
echo "$(basename "$0")" "<device> <windows iso> [mbr/gpt/gptntfs/gpt+uefintfs]"
|
||||
echo
|
||||
@@ -203,7 +222,8 @@ then
|
||||
echo
|
||||
echo "gpt+uefintfs mode: alternative hacky installation method, not recommended."
|
||||
echo " This mode uses NTFS partition and third-party 'uefintfs' bootloader."
|
||||
echo " GPT+NTFS(data)+FAT32(efi), UEFI only, NO Secure Boot support."
|
||||
echo " GPT+NTFS(data)+FAT32(efi), UEFI only, supports Secure Boot"
|
||||
echo " (since uefintfs Oct 23, 2021 release)."
|
||||
echo " Large install.wim file will not be split."
|
||||
echo
|
||||
echo "${bold} == Removable storage list ==${normal}"
|
||||
@@ -244,6 +264,8 @@ then
|
||||
# MBR FAT32
|
||||
if [[ "$labeltype" == "mbr" ]];
|
||||
then
|
||||
isolabel="$(sanitize_iso_name "$isolabel")"
|
||||
|
||||
echo "${bold} == Creating new MBR-formatted partition table ==${normal}"
|
||||
format_drive "dos" "$dev"
|
||||
|
||||
@@ -261,6 +283,8 @@ then
|
||||
# GPT FAT32
|
||||
elif [[ "$labeltype" == "gpt" ]];
|
||||
then
|
||||
isolabel="$(sanitize_iso_name "$isolabel")"
|
||||
|
||||
echo "${bold} == Creating new GPT-formatted partition table ==${normal}"
|
||||
format_drive "gpt" "$dev"
|
||||
|
||||
@@ -325,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"
|
||||
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}"
|
||||
|
||||
Reference in New Issue
Block a user