Created
November 23, 2022 20:55
-
-
Save jcassette/71724b7eb207b54e0c45313faffb919f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| iso_path="$1" | |
| img_path="$2" | |
| dd if=/dev/zero of="$img_path" bs=1MB count=8000 status=progress | |
| parted --script "$img_path" -- \ | |
| mklabel gpt \ | |
| mkpart P1 fat32 1MB 1000MB \ | |
| mkpart P2 ntfs 1000MB 8000MB | |
| iso_loop=`losetup --show --find "$iso_path"` | |
| img_loop=`losetup --partscan --show --find "$img_path"` | |
| p1_loop=${img_loop}p1 | |
| p2_loop=${img_loop}p2 | |
| mkfs.vfat $p1_loop | |
| mkfs.ntfs $p2_loop | |
| iso_mount=`mktemp --directory` | |
| p1_mount=`mktemp --directory` | |
| p2_mount=`mktemp --directory` | |
| mount $iso_loop $iso_mount | |
| mount $p1_loop $p1_mount | |
| mount $p2_loop $p2_mount | |
| rsync --recursive --progress --exclude=/sources --include=/sources/boot.wim $iso_mount/ $p1_mount/ | |
| rsync --recursive --progress $iso_mount/ $p2_mount/ | |
| umount $iso_mount | |
| umount $p1_mount | |
| umount $p2_mount | |
| losetup -d $iso_loop | |
| losetup -d $img_loop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment