summaryrefslogtreecommitdiff
path: root/update_and_start.sh
diff options
context:
space:
mode:
authorBotond Hende <nettingman@gmail.com>2024-11-19 01:05:04 +0100
committerBotond Hende <nettingman@gmail.com>2024-11-19 01:05:04 +0100
commiteb0aeb75182e32eaf74efbcf37e006f1013efb08 (patch)
treee945111dfffd607b6dd3727609b05ab45300fd26 /update_and_start.sh
initial commit
Diffstat (limited to 'update_and_start.sh')
-rwxr-xr-xupdate_and_start.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/update_and_start.sh b/update_and_start.sh
new file mode 100755
index 0000000..93ff5c3
--- /dev/null
+++ b/update_and_start.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+SERVER_PATH=/opt/ss14/server
+BUILD_JSON_PATH="$SERVER_PATH"/build.json
+SERVER="$SERVER_PATH"/Robust.Server
+
+TEMP_ZIP_PATH=/tmp/ss14-temp.zip
+
+LATEST_VER=$(curl https://wizards.cdn.spacestation14.com/fork/wizards | sed -nE 's/(\s*)<dd><span class="versionNumber">(.*)<\/span><\/dd>/\2/p' | head -1)
+
+if [ \! -f "$BUILD_JSON_PATH" ] || ! grep -q "$LATEST_VER" "$BUILD_JSON_PATH"; then
+ rm -r "$SERVER_PATH"/*
+
+ # ARM64 version
+ wget "https://wizards.cdn.spacestation14.com/fork/wizards/version/$LATEST_VER/file/SS14.Server_linux-arm64.zip" -O "$TEMP_ZIP_PATH"
+
+ # x64 version
+ #wget "https://wizards.cdn.spacestation14.com/fork/wizards/version/$LATEST_VER/file/SS14.Server_linux-x64.zip" -O "$TEMP_ZIP_PATH"
+
+ unzip "$TEMP_ZIP_PATH" -d "$SERVER_PATH"
+ rm "$TEMP_ZIP_PATH"
+
+ chmod +x "$SERVER"
+ cp server_config.toml "$SERVER_PATH"
+fi
+
+"$SERVER"