From 6a235366e5f8d7a5e4d308b82b4e9ba343c25a6e Mon Sep 17 00:00:00 2001 From: zontreck Date: Sun, 29 Jun 2025 10:21:41 -0700 Subject: [PATCH] Change the way that Vintage Story API is added to the CI server --- LinuxGeneralCompiler/Dockerfile | 25 ++++++++--------- LinuxGeneralCompiler/dlvs.sh | 34 +++++++++++++++++++++++ LinuxGeneralCompiler/mkdotgame | 8 ++++++ LinuxGeneralCompiler/pullvs.sh | 38 ++++++++++++++++++++++++++ LinuxGeneralCompiler/update_vs_dotgame | 4 --- 5 files changed, 92 insertions(+), 17 deletions(-) create mode 100644 LinuxGeneralCompiler/dlvs.sh create mode 100755 LinuxGeneralCompiler/mkdotgame create mode 100644 LinuxGeneralCompiler/pullvs.sh delete mode 100755 LinuxGeneralCompiler/update_vs_dotgame diff --git a/LinuxGeneralCompiler/Dockerfile b/LinuxGeneralCompiler/Dockerfile index 4c01848..7c369ce 100644 --- a/LinuxGeneralCompiler/Dockerfile +++ b/LinuxGeneralCompiler/Dockerfile @@ -1,17 +1,9 @@ -FROM git.zontreck.com/packages/appimage:latest AS BUILDER - -WORKDIR / -RUN wget https://cdn.vintagestory.at/gamefiles/stable/vs_server_linux-x64_1.20.12.tar.gz -WORKDIR /vintagestory -RUN tar -xvf /vs_server_linux-x64_1.20.12.tar.gz && rm /*.tar.gz - - FROM git.zontreck.com/packages/appimage:latest ENV PUB NAN ENV AGENT NAN - -LABEL VS_API 1.20.12 +ENV VSAPI 1 +LABEL VINTAGESTORY API is available WORKDIR / ADD ./entrypoint.sh /entrypoint.sh @@ -19,9 +11,16 @@ RUN chmod +x /entrypoint.sh WORKDIR /root/.local/share -COPY --from=BUILDER --chown=root:root /vintagestory ./vintagestory -ADD ./update_vs_dotgame /bin/update_vs_dotgame -RUN chmod +x /bin/update_vs_dotgame +ADD ./dlvs.sh /bin/dlvs +ADD ./pullvs.sh /bin/pullvs +ADD ./mkdotgame /bin/mkdotgame + +# Bootstrap all the commonly used Vintage Story versions + +RUN chmod +x /bin/mkdotgame && \ + ln -sfv /bin/mkdotgame /bin/update_vs_dotgame && \ + chmod +x /bin/dlvs && chmod +x /bin/pullvs && \ + pullvs ENTRYPOINT [ "/bin/bash", "/entrypoint.sh" ] diff --git a/LinuxGeneralCompiler/dlvs.sh b/LinuxGeneralCompiler/dlvs.sh new file mode 100644 index 0000000..e3fe42e --- /dev/null +++ b/LinuxGeneralCompiler/dlvs.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Function to download game files based on version +download_game() { + local version=$1 + local url + local extract_path="/vintagestory_${version}" + + # Check if version contains a "-" + if [[ $version == *"-"* ]]; then + url="https://cdn.vintagestory.at/gamefiles/unstable/vs_server_linux-x64_${version}.tar.gz" + else + url="https://cdn.virtualstory.at/gamefiles/stable/vs_server_linux-x64_${version}.tar.gz" + fi + + # Check if extract path already exists and is not empty + if [ -d "$extract_path" ] && [ ! -z "$(ls -A "$extract_path")" ]; then + echo "Extract path $extract_path already exists and is not empty, skipping download." + return + fi + + # Download game files + download_path="/vs_server_linux-x64_${version}" + wget "$url" -O "${download_path}.tar.gz" + + # Extract and clean up + cd $extract_path + tar -xvf "${download_path}.tar.gz" && rm "${download_path}"/"${version}"*.tar.gz + cd / +} + +# Call the function with version as argument (e.g. "1.20.12") + +download_game "$1" \ No newline at end of file diff --git a/LinuxGeneralCompiler/mkdotgame b/LinuxGeneralCompiler/mkdotgame new file mode 100755 index 0000000..f182f01 --- /dev/null +++ b/LinuxGeneralCompiler/mkdotgame @@ -0,0 +1,8 @@ +#!/bin/bash +# + +local version=$1 + +rm .game || true +dlvs $version || true +ln -sv "~/.local/share/vintagestory_${version}" .game \ No newline at end of file diff --git a/LinuxGeneralCompiler/pullvs.sh b/LinuxGeneralCompiler/pullvs.sh new file mode 100644 index 0000000..a340fb2 --- /dev/null +++ b/LinuxGeneralCompiler/pullvs.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# Function to download game files based on version +download_game() { + dlvs $1 +} + +# Call the function with version as argument (e.g. "1.20.12") + +# Current Pre-release + +download_game "1.21.0-pre.1" + +# Releases + +download_game "1.20.12" +download_game "1.20.11" +download_game "1.20.10" +download_game "1.20.9" +download_game "1.20.8" +download_game "1.20.7" +download_game "1.20.6" +download_game "1.20.5" +download_game "1.20.4" +download_game "1.20.3" +download_game "1.20.2" +download_game "1.20.1" +download_game "1.20.0" +download_game "1.19.8" +download_game "1.19.7" +download_game "1.19.6" +download_game "1.19.5" +download_game "1.19.4" +download_game "1.19.3" +download_game "1.19.2" +download_game "1.19.1" +download_game "1.19.0" +download_game "1.18.15" diff --git a/LinuxGeneralCompiler/update_vs_dotgame b/LinuxGeneralCompiler/update_vs_dotgame deleted file mode 100755 index 0a28d45..0000000 --- a/LinuxGeneralCompiler/update_vs_dotgame +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -rm .game || true -ln -sv ~/.local/share/vintagestory .game \ No newline at end of file