Skip to content

Commit

Permalink
feat: Make resolution configurable (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Jun 11, 2024
1 parent ff74d0e commit 7364673
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/define.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -Eeuo pipefail

: "${XRES:=""}"
: "${YRES:=""}"
: "${VERIFY:=""}"
: "${REGION:=""}"
: "${MANUAL:=""}"
Expand Down
21 changes: 18 additions & 3 deletions src/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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/<VerticalResolution>1080<\/VerticalResolution>/<VerticalResolution>$YRES<\/VerticalResolution>/g" "$asset"
sed -i "s/<HorizontalResolution>1920<\/HorizontalResolution>/<HorizontalResolution>$XRES<\/HorizontalResolution>/g" "$asset"

culture=$(getLanguage "$language" "culture")

if [ -n "$culture" ] && [[ "${culture,,}" != "en-us" ]]; then
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/samba.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 7364673

Please sign in to comment.