Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4dbe548678 | ||
|
|
79aa386d84 | ||
|
|
b0d00df519 | ||
|
|
6bc0ae55c2 | ||
|
|
dad6eeacef | ||
|
|
e9e324bf89 |
@@ -70,3 +70,4 @@ This script uses:
|
|||||||
* **lsblk** and **sfdisk** from [util-linux](https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/)
|
* **lsblk** and **sfdisk** from [util-linux](https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/)
|
||||||
* [**ms-sys**](http://ms-sys.sourceforge.net/) for native Windows 7 MBR and NTFS bootloaders
|
* [**ms-sys**](http://ms-sys.sourceforge.net/) for native Windows 7 MBR and NTFS bootloaders
|
||||||
* [**p7zip**](https://www.7-zip.org/) for ISO extraction
|
* [**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)
|
||||||
|
|||||||
+23
-5
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
set -e # errexit
|
set -e # errexit
|
||||||
set -f # noglob
|
set -f # noglob
|
||||||
set +o braceexpand # disable braceexpand
|
set +o braceexpand # disable braceexpand
|
||||||
@@ -63,7 +63,7 @@ function check_installwim_gt4gib() {
|
|||||||
|
|
||||||
function create_partitions() {
|
function create_partitions() {
|
||||||
local mbrscript="- - 7 *"
|
local mbrscript="- - 7 *"
|
||||||
local gptscript="- - U *"
|
local gptscript="- - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 *"
|
||||||
local gptntfsscript="- 1MiB U *\n- - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 *"
|
local gptntfsscript="- 1MiB U *\n- - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 *"
|
||||||
|
|
||||||
if [[ "$1" == "dos" ]] || [[ "$1" == "gpt" ]] || [[ "$1" == "gptntfs" ]];
|
if [[ "$1" == "dos" ]] || [[ "$1" == "gpt" ]] || [[ "$1" == "gptntfs" ]];
|
||||||
@@ -107,7 +107,11 @@ function get_dev_partition_num() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function write_uefintfs() {
|
function write_uefintfs() {
|
||||||
cat "$dirpath/uefi-ntfs.img" > "$1"
|
if [ -a "$dirpath/uefi-ntfs.img" ]; then
|
||||||
|
cat "$dirpath/uefi-ntfs.img" > "$1"
|
||||||
|
elif [ -a "/usr/share/windows2usb/uefi-ntfs.img" ]; then
|
||||||
|
cat "/usr/share/windows2usb/uefi-ntfs.img" > "$1"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function extract_iso() {
|
function extract_iso() {
|
||||||
@@ -163,6 +167,11 @@ then
|
|||||||
uefimode=
|
uefimode=
|
||||||
[[ "$labeltype" == "gpt" ]] && uefimode=1
|
[[ "$labeltype" == "gpt" ]] && uefimode=1
|
||||||
[[ "$labeltype" == "gptntfs" ]] && uefimode=1
|
[[ "$labeltype" == "gptntfs" ]] && uefimode=1
|
||||||
|
mountntfs_cmd="mount.ntfs-3g"
|
||||||
|
if ! command -v "$mountntfs_cmd" > /dev/null;
|
||||||
|
then
|
||||||
|
mountntfs_cmd="mount"
|
||||||
|
fi
|
||||||
|
|
||||||
check_requirements
|
check_requirements
|
||||||
check_iso_and_device "$isopath" "$dev"
|
check_iso_and_device "$isopath" "$dev"
|
||||||
@@ -183,6 +192,9 @@ then
|
|||||||
echo "${bold} == Creating new MBR-formatted partition table ==${normal}"
|
echo "${bold} == Creating new MBR-formatted partition table ==${normal}"
|
||||||
format_drive "dos" "$dev"
|
format_drive "dos" "$dev"
|
||||||
|
|
||||||
|
echo "${bold} == Waiting 3 seconds to settle new partition layout ==${normal}"
|
||||||
|
sleep 3
|
||||||
|
|
||||||
echo "${bold} == Creating NTFS partition ==${normal}"
|
echo "${bold} == Creating NTFS partition ==${normal}"
|
||||||
create_partitions "dos" "$dev"
|
create_partitions "dos" "$dev"
|
||||||
mkfs.ntfs -L "$isolabel" -f "$(get_dev_partition_num "${dev}" "1")"
|
mkfs.ntfs -L "$isolabel" -f "$(get_dev_partition_num "${dev}" "1")"
|
||||||
@@ -192,7 +204,7 @@ then
|
|||||||
ms-sys -n "$(get_dev_partition_num "${dev}" "1")"
|
ms-sys -n "$(get_dev_partition_num "${dev}" "1")"
|
||||||
|
|
||||||
echo "${bold} == Mounting data partition ==${normal}"
|
echo "${bold} == Mounting data partition ==${normal}"
|
||||||
mount "$(get_dev_partition_num "${dev}" "1")" "$partpath"
|
"$mountntfs_cmd" "$(get_dev_partition_num "${dev}" "1")" "$partpath"
|
||||||
|
|
||||||
# GPT
|
# GPT
|
||||||
elif [[ "$labeltype" == "gpt" ]];
|
elif [[ "$labeltype" == "gpt" ]];
|
||||||
@@ -208,6 +220,9 @@ then
|
|||||||
echo "${bold} == Creating new GPT-formatted partition table ==${normal}"
|
echo "${bold} == Creating new GPT-formatted partition table ==${normal}"
|
||||||
format_drive "gpt" "$dev"
|
format_drive "gpt" "$dev"
|
||||||
|
|
||||||
|
echo "${bold} == Waiting 3 seconds to settle new partition layout ==${normal}"
|
||||||
|
sleep 3
|
||||||
|
|
||||||
echo "${bold} == Creating UEFI FAT partition ==${normal}"
|
echo "${bold} == Creating UEFI FAT partition ==${normal}"
|
||||||
create_partitions "gpt" "$dev"
|
create_partitions "gpt" "$dev"
|
||||||
mkfs.vfat -n "${isolabel:0:11}" "$(get_dev_partition_num "${dev}" "1")"
|
mkfs.vfat -n "${isolabel:0:11}" "$(get_dev_partition_num "${dev}" "1")"
|
||||||
@@ -221,13 +236,16 @@ then
|
|||||||
echo "${bold} == Creating new GPT-formatted partition table ==${normal}"
|
echo "${bold} == Creating new GPT-formatted partition table ==${normal}"
|
||||||
format_drive "gpt" "$dev"
|
format_drive "gpt" "$dev"
|
||||||
|
|
||||||
|
echo "${bold} == Waiting 3 seconds to settle new partition layout ==${normal}"
|
||||||
|
sleep 3
|
||||||
|
|
||||||
echo "${bold} == Creating UEFI FAT and Microsoft NTFS partitions ==${normal}"
|
echo "${bold} == Creating UEFI FAT and Microsoft NTFS partitions ==${normal}"
|
||||||
create_partitions "gptntfs" "$dev"
|
create_partitions "gptntfs" "$dev"
|
||||||
write_uefintfs "$(get_dev_partition_num "${dev}" "1")"
|
write_uefintfs "$(get_dev_partition_num "${dev}" "1")"
|
||||||
mkfs.ntfs -L "$isolabel" -f "$(get_dev_partition_num "${dev}" "2")"
|
mkfs.ntfs -L "$isolabel" -f "$(get_dev_partition_num "${dev}" "2")"
|
||||||
|
|
||||||
echo "${bold} == Mounting data partition ==${normal}"
|
echo "${bold} == Mounting data partition ==${normal}"
|
||||||
mount "$(get_dev_partition_num "${dev}" "2")" "$partpath"
|
"$mountntfs_cmd" "$(get_dev_partition_num "${dev}" "2")" "$partpath"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "${bold} == Extracting files from ISO to the partition ==${normal}"
|
echo "${bold} == Extracting files from ISO to the partition ==${normal}"
|
||||||
|
|||||||
Reference in New Issue
Block a user