fix: Bootmode migration

This commit is contained in:
Kroese 2024-04-27 14:58:34 +02:00 committed by GitHub
parent 607a8c7f5b
commit 7e4a6ff458
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -283,7 +283,9 @@ finishInstall() {
cp /run/version "$STORAGE/windows.ver"
if [[ "${BOOT_MODE,,}" == "windows_legacy" ]]; then
echo "$MACHINE" > "$STORAGE/windows.old"
if [[ "${MACHINE,,}" != "q35" ]]; then
echo "$MACHINE" > "$STORAGE/windows.old"
fi
echo "$BOOT_MODE" > "$STORAGE/windows.mode"
else
# Enable secure boot + TPM on manual installs as Win11 requires
@ -1156,14 +1158,15 @@ bootWindows() {
if [ -s "$STORAGE/windows.mode" ] && [ -f "$STORAGE/windows.mode" ]; then
BOOT_MODE=$(<"$STORAGE/windows.mode")
if [ -f "$STORAGE/windows.old" ]; then
if [ -s "$STORAGE/windows.old" ] && [ -f "$STORAGE/windows.old" ]; then
MACHINE=$(<"$STORAGE/windows.old")
[ -z "$MACHINE" ] && MACHINE="q35"
fi
rm -rf "$TMP"
return 0
fi
# Migrations
if [ -f "$STORAGE/windows.old" ]; then
MACHINE=$(<"$STORAGE/windows.old")
[ -z "$MACHINE" ] && MACHINE="q35"