2024-01-14 15:39:24 +00:00
|
|
|
#!/usr/bin/env bash
|
2024-01-14 14:19:58 +00:00
|
|
|
set -Eeuo pipefail
|
|
|
|
|
2024-01-14 19:32:24 +00:00
|
|
|
: "${VERSION:="win11x64"}"
|
|
|
|
|
|
|
|
ARGUMENTS="-chardev socket,id=chrtpm,path=/tmp/emulated_tpm/swtpm-sock $ARGUMENTS"
|
|
|
|
ARGUMENTS="-tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0 $ARGUMENTS"
|
2024-01-14 14:19:58 +00:00
|
|
|
|
2024-01-14 15:35:58 +00:00
|
|
|
BASE="$VERSION.iso"
|
|
|
|
[ -f "$STORAGE/$BASE" ] && return 0
|
2024-01-14 14:19:58 +00:00
|
|
|
|
2024-01-14 16:25:33 +00:00
|
|
|
# Check if running with interactive TTY or redirected to docker log
|
|
|
|
if [ -t 1 ]; then
|
|
|
|
PROGRESS="--progress=bar:noscroll"
|
|
|
|
else
|
|
|
|
PROGRESS="--progress=dot:giga"
|
|
|
|
fi
|
|
|
|
|
2024-01-14 19:32:24 +00:00
|
|
|
DEST="$STORAGE/drivers.img"
|
2024-01-14 19:33:50 +00:00
|
|
|
[ ! -f "$DEST" ] && cp /run/drivers.iso "$DEST"
|
2024-01-14 19:32:24 +00:00
|
|
|
|
|
|
|
rm -rf "$STORAGE/tmp"
|
|
|
|
mkdir -p "$STORAGE/tmp"
|
|
|
|
SCRIPT="$STORAGE/tmp/mido.sh"
|
2024-01-14 14:19:58 +00:00
|
|
|
|
2024-01-14 17:05:42 +00:00
|
|
|
cp /run/mido.sh "$SCRIPT"
|
|
|
|
chmod +x "$SCRIPT"
|
2024-01-14 14:19:58 +00:00
|
|
|
|
2024-01-14 19:32:24 +00:00
|
|
|
cd "$STORAGE/tmp"
|
2024-01-14 17:05:42 +00:00
|
|
|
bash "$SCRIPT" "$VERSION"
|
|
|
|
rm -f "$SCRIPT"
|
2024-01-14 14:19:58 +00:00
|
|
|
|
2024-01-14 19:32:24 +00:00
|
|
|
[ ! -f "$STORAGE/tmp/$BASE" ] && error "Failed to download $VERSION.iso from the Microsoft servers!" && exit 66
|
2024-01-14 14:19:58 +00:00
|
|
|
|
2024-01-14 19:32:24 +00:00
|
|
|
info "Modifying ISO to remove keypress requirement during boot..."
|
2024-01-14 14:19:58 +00:00
|
|
|
|
2024-01-14 19:32:24 +00:00
|
|
|
7z x "$BASE" -ounpack
|
|
|
|
genisoimage -b boot/etfsboot.com -no-emul-boot -c BOOT.CAT -iso-level 4 -J -l -D -N -joliet-long -relaxed-filenames -v -V "Custom" -udf -boot-info-table -eltorito-alt-boot -eltorito-boot efi/microsoft/boot/efisys_noprompt.bin -no-emul-boot -o "$STORAGE/tmp/$BASE.tmp" -allow-limited-size unpack
|
2024-01-14 14:19:58 +00:00
|
|
|
|
2024-01-14 19:32:24 +00:00
|
|
|
mv "$STORAGE/tmp/$BASE.tmp" "$STORAGE/$BASE"
|
|
|
|
rm -rf "$STORAGE/tmp"
|
2024-01-14 14:19:58 +00:00
|
|
|
|
2024-01-14 19:32:24 +00:00
|
|
|
cd /run
|
2024-01-14 14:19:58 +00:00
|
|
|
|
|
|
|
return 0
|