From 73646734e1edff7222fc3361d434c7528a41c873 Mon Sep 17 00:00:00 2001 From: Kroese Date: Tue, 11 Jun 2024 02:22:26 +0200 Subject: [PATCH] feat: Make resolution configurable (#155) --- src/define.sh | 2 ++ src/install.sh | 21 ++++++++++++++++++--- src/samba.sh | 4 ++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/define.sh b/src/define.sh index 24d5f79..5bc3223 100644 --- a/src/define.sh +++ b/src/define.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash set -Eeuo pipefail +: "${XRES:=""}" +: "${YRES:=""}" : "${VERIFY:=""}" : "${REGION:=""}" : "${MANUAL:=""}" diff --git a/src/install.sh b/src/install.sh index 0aada6e..b8cd8cf 100644 --- a/src/install.sh +++ b/src/install.sh @@ -119,10 +119,11 @@ finishInstall() { fi rm -f "$STORAGE/windows.old" - rm -f "$STORAGE/windows.type" + rm -f "$STORAGE/windows.vga" rm -f "$STORAGE/windows.base" rm -f "$STORAGE/windows.boot" rm -f "$STORAGE/windows.mode" + rm -f "$STORAGE/windows.type" cp -f /run/version "$STORAGE/windows.ver" @@ -155,6 +156,10 @@ finishInstall() { fi fi + if [ -n "${VGA:-}" ] && [[ "${VGA:-}" != "virtio" ]] && [[ "${VGA:-}" != "ramfb" ]]; then + echo "$VGA" > "$STORAGE/windows.vga" + fi + if [ -n "${DISK_TYPE:-}" ] && [[ "${DISK_TYPE:-}" != "scsi" ]]; then echo "$DISK_TYPE" > "$STORAGE/windows.type" fi @@ -613,6 +618,12 @@ updateXML() { local language="$2" local culture region user admin pass keyboard + [ -z "$YRES" ] && YRES="720" + [ -z "$XRES" ] && XRES="1280" + + sed -i "s/1080<\/VerticalResolution>/$YRES<\/VerticalResolution>/g" "$asset" + sed -i "s/1920<\/HorizontalResolution>/$XRES<\/HorizontalResolution>/g" "$asset" + culture=$(getLanguage "$language" "culture") if [ -n "$culture" ] && [[ "${culture,,}" != "en-us" ]]; then @@ -967,10 +978,14 @@ bootWindows() { rm -rf "$TMP" - [[ "${PLATFORM,,}" == "arm64" ]] && VGA="virtio-gpu" + if [ -s "$STORAGE/windows.vga" ] && [ -f "$STORAGE/windows.vga" ]; then + [ -z "${VGA:-}" ] && VGA=$(<"$STORAGE/windows.vga") + else + [ -z "${VGA:-}" ] && [[ "${PLATFORM,,}" == "arm64" ]] && VGA="virtio-gpu" + fi if [ -s "$STORAGE/windows.type" ] && [ -f "$STORAGE/windows.type" ]; then - DISK_TYPE=$(<"$STORAGE/windows.type") + [ -z "${DISK_TYPE:-}" ] && DISK_TYPE=$(<"$STORAGE/windows.type") fi if [ -s "$STORAGE/windows.mode" ] && [ -f "$STORAGE/windows.mode" ]; then diff --git a/src/samba.sh b/src/samba.sh index cc865d7..26119f1 100644 --- a/src/samba.sh +++ b/src/samba.sh @@ -3,8 +3,8 @@ set -Eeuo pipefail : "${SAMBA:="Y"}" -[[ "$SAMBA" != [Yy1]* ]] && return 0 -[[ "$NETWORK" != [Yy1]* ]] && return 0 +[[ "$SAMBA" == [Nn]* ]] && return 0 +[[ "$NETWORK" == [Nn]* ]] && return 0 hostname="host.lan" interface="dockerbridge"