feat: Store bootmode in file

This commit is contained in:
Kroese 2024-04-22 15:03:25 +02:00 committed by GitHub
parent 3467b5d55f
commit 9c07be17b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -262,7 +262,7 @@ finishInstall() {
return 1 return 1
fi fi
if [ -w "$iso" ]; then if [ -w "$iso" ] && [[ "$aborted" != [Yy1]* ]]; then
# Mark ISO as prepared via magic byte # Mark ISO as prepared via magic byte
if ! printf '\x16' | dd of="$iso" bs=1 seek=0 count=1 conv=notrunc status=none; then if ! printf '\x16' | dd of="$iso" bs=1 seek=0 count=1 conv=notrunc status=none; then
error "Failed to set magic byte!" error "Failed to set magic byte!"
@ -1126,6 +1126,12 @@ bootWindows() {
return 0 return 0
fi fi
if [ -s "$STORAGE/windows.mode" ] && [ -f "$STORAGE/windows.mode" ]; then
BOOT_MODE=$(<"$STORAGE/windows.mode")
rm -rf "$TMP"
return 0
fi
local creation="1.10" local creation="1.10"
local minimal="2.14" local minimal="2.14"
@ -1138,6 +1144,7 @@ bootWindows() {
if (( $(echo "$creation < $minimal" | bc -l) )); then if (( $(echo "$creation < $minimal" | bc -l) )); then
if [[ "${BOOT_MODE,,}" == "windows" ]]; then if [[ "${BOOT_MODE,,}" == "windows" ]]; then
BOOT_MODE="windows_secure" BOOT_MODE="windows_secure"
echo "$BOOT_MODE" > "$STORAGE/windows.mode"
if [ -f "$STORAGE/windows.rom" ] && [ ! -f "$STORAGE/$BOOT_MODE.rom" ]; then if [ -f "$STORAGE/windows.rom" ] && [ ! -f "$STORAGE/$BOOT_MODE.rom" ]; then
mv "$STORAGE/windows.rom" "$STORAGE/$BOOT_MODE.rom" mv "$STORAGE/windows.rom" "$STORAGE/$BOOT_MODE.rom"
fi fi
@ -1145,10 +1152,6 @@ bootWindows() {
mv "$STORAGE/windows.vars" "$STORAGE/$BOOT_MODE.vars" mv "$STORAGE/windows.vars" "$STORAGE/$BOOT_MODE.vars"
fi fi
fi fi
else
if [ -s "$STORAGE/windows.mode" ] && [ -f "$STORAGE/windows.mode" ]; then
BOOT_MODE=$(<"$STORAGE/windows.mode")
fi
fi fi
rm -rf "$TMP" rm -rf "$TMP"