@@ -42,6 +42,15 @@ Log() {
4242download_server () {
4343 LogAction " Checking server version"
4444
45+ # Check architecture and log if using QEMU
46+ local ARCH=$( uname -m)
47+ if [ " $ARCH " = " aarch64" ] || [ " $ARCH " = " arm64" ]; then
48+ LogInfo " Running on ARM64 architecture"
49+ LogInfo " x86_64 downloader will use QEMU emulation"
50+ else
51+ LogInfo " Running on $ARCH architecture"
52+ fi
53+
4554 local SERVER_FILES=" /home/hytale/server-files"
4655 local DOWNLOADER_URL=" https://downloader.hytale.com/hytale-downloader.zip"
4756 local DOWNLOADER_ZIP=" $SERVER_FILES /hytale-downloader.zip"
@@ -81,22 +90,30 @@ download_server() {
8190 local CREDENTIALS_FILE=" $DOWNLOADER_DIR /.hytale-downloader-credentials.json"
8291 local latest_version=" "
8392 local current_version=" "
93+ local PATCHLINE=" ${PATCHLINE:- release} "
94+ local DOWNLOADER_BASENAME
95+ DOWNLOADER_BASENAME=" $( basename " $DOWNLOADER_EXEC " ) "
96+
97+ # Build downloader command with patchline
98+ local DOWNLOADER_CMD=" ./$DOWNLOADER_BASENAME "
99+ if [ " $PATCHLINE " != " release" ]; then
100+ DOWNLOADER_CMD=" $DOWNLOADER_CMD -patchline $PATCHLINE "
101+ LogInfo " Using patchline: $PATCHLINE "
102+ fi
84103
85104 if [ ! -f " $CREDENTIALS_FILE " ]; then
86105 # First boot - no credentials yet, skip version check
87106 LogInfo " First time setup - authentication required"
88107 else
89108 # Check latest available version
90109 LogInfo " Checking latest version..."
91- latest_version=$( ./ $( basename " $DOWNLOADER_EXEC " ) -print-version)
92-
93- if [ -z " $latest_version " ] ; then
110+ if latest_version=$( eval " $DOWNLOADER_CMD -print-version" 2> /dev/null ) && [ -n " $latest_version " ] ; then
111+ LogInfo " Latest available version: $latest_version "
112+ else
94113 LogError " Failed to get latest version"
95114 return 1
96115 fi
97116
98- LogInfo " Latest available version: $latest_version "
99-
100117 # Check current installed version
101118 if [ -f " $VERSION_FILE " ]; then
102119 current_version=$( cat " $VERSION_FILE " )
@@ -116,7 +133,8 @@ download_server() {
116133 fi
117134
118135 LogInfo " Downloading server files (this may take a while)..."
119- ./$( basename " $DOWNLOADER_EXEC " ) -download-path " $SERVER_FILES /game.zip" || {
136+ cd " $( dirname " $DOWNLOADER_EXEC " ) " || exit 1
137+ eval " $DOWNLOADER_CMD -download-path '$SERVER_FILES /game.zip'" || {
120138 LogError " Failed to download server files"
121139 return 1
122140 }
@@ -141,6 +159,14 @@ download_server() {
141159 return 1
142160 fi
143161
162+ # Get version if we don't have it yet (first boot or version check was skipped)
163+ if [ -z " $latest_version " ]; then
164+ cd " $( dirname " $DOWNLOADER_EXEC " ) " || exit 1
165+ if latest_version=$( eval " $DOWNLOADER_CMD -print-version" 2> /dev/null) && [ -n " $latest_version " ]; then
166+ LogInfo " Server version: $latest_version "
167+ fi
168+ fi
169+
144170 # Remove outdated AOT cache only if this was an update
145171 if [ -n " $current_version " ] && [ " $current_version " != " $latest_version " ]; then
146172 if [ -f " $SERVER_FILES /Server/HytaleServer.aot" ]; then
@@ -150,9 +176,12 @@ download_server() {
150176 fi
151177
152178 # Save version
153- echo " $latest_version " > " $VERSION_FILE "
154-
155- LogSuccess " Server download completed (version $latest_version )"
179+ if [ -n " $latest_version " ]; then
180+ echo " $latest_version " > " $VERSION_FILE "
181+ LogSuccess " Server download completed (version $latest_version )"
182+ else
183+ LogSuccess " Server download completed"
184+ fi
156185}
157186
158187# Attempt to shutdown the server gracefully
0 commit comments