feat: Support custom ISO (#21)

This commit is contained in:
Kroese 2024-01-15 15:15:12 +01:00 committed by GitHub
parent 087e1c9b7f
commit b42cf1a1f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,27 +9,36 @@ ARGUMENTS="-tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0 $
BASE="$VERSION.iso" BASE="$VERSION.iso"
[ -f "$STORAGE/$BASE" ] && return 0 [ -f "$STORAGE/$BASE" ] && return 0
rm -rf "$STORAGE/tmp" TMP="$STORAGE/tmp"
mkdir -p "$STORAGE/tmp" rm -rf "$TMP"
SCRIPT="$STORAGE/tmp/mido.sh" mkdir -p "$TMP"
cp /run/mido.sh "$SCRIPT" if [ -f "$STORAGE/custom.iso" ]; then
chmod +x "$SCRIPT" cp "$STORAGE/custom.iso" "$TMP/$BASE"
fi
cd "$STORAGE/tmp" if [ ! -f "$TMP/$BASE" ]; then
bash "$SCRIPT" "$VERSION"
rm -f "$SCRIPT"
[ ! -f "$STORAGE/tmp/$BASE" ] && error "Failed to download $VERSION.iso from the Microsoft servers!" && exit 66 SCRIPT="$TMP/mido.sh"
cp /run/mido.sh "$SCRIPT"
chmod +x "$SCRIPT"
cd "$TMP"
bash "$SCRIPT" "$VERSION"
cd /run
rm -f "$SCRIPT"
[ ! -f "$TMP/$BASE" ] && error "Failed to download $VERSION.iso from the Microsoft servers!" && exit 66
fi
info "Customizing ISO to remove keypress requirement during boot..." info "Customizing ISO to remove keypress requirement during boot..."
7z x "$BASE" -ounpack DIR="$TMP/unpack"
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 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"
mv "$STORAGE/tmp/$BASE.tmp" "$STORAGE/$BASE" mv "$TMP/$BASE.tmp" "$STORAGE/$BASE"
rm -rf "$STORAGE/tmp" rm -rf "$TMP"
cd /run
return 0 return 0