From 24c7a2ca7d665588b2aa492db3061ee91f1dfbfa Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Thu, 2 Jul 2020 17:17:52 -0500 Subject: [PATCH] Adjusted VERSION handling to allow specific versions Fixes #79 --- README.md | 1 + bedrock-entry.sh | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 801998f..1411791 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ For Minecraft Java Edition you'll need to use this image instead: - `1.13` : the latest version of 1.13 - `1.14` : the latest version of 1.14 - `1.16` : the latest version of 1.16 + - otherwise any specific server version can be provided to allow for temporary bug avoidance, etc - `UID` (default derived from `/data` owner) : can be set to a specific user ID to run the bedrock server process - `GID` (default derived from `/data` owner) : can be set to a specific group ID to run the diff --git a/bedrock-entry.sh b/bedrock-entry.sh index b46baa0..ea2924c 100755 --- a/bedrock-entry.sh +++ b/bedrock-entry.sh @@ -14,23 +14,23 @@ fi set -e -case ${VERSION} in +case ${VERSION^^} in 1.11) VERSION=1.11.4.2 ;; 1.12) VERSION=1.12.0.28 ;; - 1.13|PREVIOUS) + 1.13) VERSION=1.13.0.34 ;; - 1.14) + 1.14|PREVIOUS) VERSION=1.14.60.5 ;; 1.16) - VERSION=1.16.0.2 + VERSION=1.16.1.02 ;; - *) + LATEST) for a in data-bi-prtid data-platform; do DOWNLOAD_URL=$(restify --attribute=${a}=serverBedrockLinux ${downloadPage} 2> /tmp/restify.out | jq -r '.[0].href' || echo '') if [[ ${DOWNLOAD_URL} ]]; then @@ -45,6 +45,9 @@ case ${VERSION} in exit 2 fi ;; + *) + # use the given version exactly + ;; esac if [ ! -f "bedrock_server-${VERSION}" ]; then @@ -56,7 +59,11 @@ if [ ! -f "bedrock_server-${VERSION}" ]; then TMP_ZIP=/tmp/$(basename "${DOWNLOAD_URL}") echo "Downloading Bedrock server version ${VERSION} ..." - curl -o ${TMP_ZIP} -fsSL ${DOWNLOAD_URL} + if ! curl -o ${TMP_ZIP} -fsSL ${DOWNLOAD_URL}; then + echo "ERROR failed to download from ${DOWNLOAD_URL}" + echo " Double check that the given VERSION is valid" + exit 2 + fi # remove only binaries and some docs, to allow for an upgrade of those rm -rf bedrock_server *.so release-notes.txt bedrock_server_how_to.html valid_known_packs.json premium_cache 2> /dev/null