feat: Unattended installation (#23)

This commit is contained in:
Kroese 2024-01-15 23:45:35 +01:00 committed by GitHub
parent b42cf1a1f3
commit f0047bd6dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 1759 additions and 22 deletions

View file

@ -1,6 +1,7 @@
#!/usr/bin/env bash
set -Eeuo pipefail
: "${ATTENDED:="N"}"
: "${VERSION:="win11x64"}"
ARGUMENTS="-chardev socket,id=chrtpm,path=/tmp/emulated_tpm/swtpm-sock $ARGUMENTS"
@ -32,11 +33,23 @@ if [ ! -f "$TMP/$BASE" ]; then
fi
info "Customizing ISO to remove keypress requirement during boot..."
info "Preparing ISO image for installation..."
DIR="$TMP/unpack"
7z x "$TMP/$BASE" -o"$DIR"
genisoimage -b boot/etfsboot.com -no-emul-boot -c BOOT.CAT -iso-level 4 -J -l -D -N -joliet-long -relaxed-filenames -v -V "$VERSION" -udf -boot-info-table -eltorito-alt-boot -eltorito-boot efi/microsoft/boot/efisys_noprompt.bin -no-emul-boot -o "$TMP/$BASE.tmp" -allow-limited-size "$DIR"
if [[ "$ATTENDED" != [Yy1]* ]]; then
if [ -f "/run/assets/$VERSION.xml" ]; then
wimlib-imagex update "$DIR/sources/boot.wim" 2 \
--command "add /run/assets/$VERSION.xml /autounattend.xml"
fi
fi
genisoimage -b boot/etfsboot.com -no-emul-boot -c BOOT.CAT -iso-level 4 -J -l -D -N -joliet-long -relaxed-filenames \
-v -V "$VERSION" -udf -boot-info-table -eltorito-alt-boot -eltorito-boot efi/microsoft/boot/efisys_noprompt.bin \
-no-emul-boot -o "$TMP/$BASE.tmp" -allow-limited-size "$DIR"
mv "$TMP/$BASE.tmp" "$STORAGE/$BASE"
rm -rf "$TMP"