From ecd253dd3ec3e0b2fb63964045fd1c2b4d2f291a Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 15 Aug 2021 12:44:31 -0500 Subject: [PATCH] Added support for TYPE=LIMBO (#994) --- README.md | 14 +++++++++++ start-configuration | 6 ++++- start-deployLimbo | 57 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 start-deployLimbo diff --git a/README.md b/README.md index ae812249..6b8abae9 100644 --- a/README.md +++ b/README.md @@ -553,6 +553,20 @@ docker run -d -v /path/on/host:/data ... \ In order to add mods, you have two options: +### Running a Limbo server + +A [Limbo](https://github.com/LOOHP/Limbo) server can be run by setting `TYPE` to `LIMBO`. + +Configuration options with defaults: + +- `LIMBO_BUILD`=LATEST + + The `VERSION` will be ignored so locate the appropriate value from [here](https://ci.loohpjames.com/job/Limbo/) to match the version expected by clients. + +- `FORCE_REDOWNLOAD`=false +- `LIMBO_SCHEMA_FILENAME`=default.schem +- `LEVEL`="Default;${LIMBO_SCHEMA_FILENAME}" + ## Running a server with a Feed the Beast modpack > **NOTE** requires one of the Debian based images listed in [the Java versions section](#running-minecraft-server-on-different-java-version). diff --git a/start-configuration b/start-configuration index 37ed677c..d3bbec3e 100644 --- a/start-configuration +++ b/start-configuration @@ -171,11 +171,15 @@ case "${TYPE^^}" in exec ${SCRIPTS:-/}start-deployCanyon "$@" ;; + LIMBO) + exec ${SCRIPTS:-/}start-deployLimbo "$@" + ;; + *) log "Invalid type: '$TYPE'" log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTBA (multiarch-only)," log " CURSE_INSTANCE, CURSEFORGE, SPONGEVANILLA, TUINITY, PURPUR" - log " CUSTOM, MAGMA, MOHIST, CATSERVER, YATOPIA, AIRPLANE, CANYON" + log " CUSTOM, MAGMA, MOHIST, CATSERVER, YATOPIA, AIRPLANE, CANYON, LIMBO" exit 1 ;; diff --git a/start-deployLimbo b/start-deployLimbo new file mode 100644 index 00000000..d9ad0fd5 --- /dev/null +++ b/start-deployLimbo @@ -0,0 +1,57 @@ +#!/bin/bash +set -euo pipefail +IFS=$'\n\t' + +. ${SCRIPTS:-/}start-utils +isDebugging && set -x + +: ${LIMBO_BUILD:=LATEST} +: ${FORCE_REDOWNLOAD:=false} +: ${LIMBO_SCHEMA_FILENAME:=default.schem} +: ${LEVEL:=Default;${LIMBO_SCHEMA_FILENAME}} + +if [[ ${LIMBO_BUILD^^} == LATEST ]]; then + LIMBO_BUILD=lastStableBuild +fi + +baseUrl="https://ci.loohpjames.com/job/Limbo/${LIMBO_BUILD}" +buildInfoUrl="${baseUrl}/api/json" +buildJson=$(curl -fsSL "${buildInfoUrl}") +if [ $? != 0 ]; then + log "ERROR failed to get build info from ${buildInfoUrl} (status=$?)" + exit 1 +fi + +PURPUR_BUILD=$(jq -r '.number' <<<${buildJson}) +artifactPath=$(jq -r '.artifacts[] | select(.fileName|test("^Limbo-")) | .relativePath' <<<${buildJson}) +defaultSchemaPath=$(jq -r '.artifacts[] | select(.fileName|test(".*\\.schem")) | .relativePath' <<<${buildJson}) + +export SERVER="purpur-${PURPUR_BUILD}.jar" + +if [ ! -f "$SERVER" ] || isTrue "$FORCE_REDOWNLOAD"; then + downloadUrl="${baseUrl}/artifact/${artifactPath}" + log "Downloading Limbo from $downloadUrl ..." + if ! curl -fsSL -o "$SERVER" "$downloadUrl"; then + log "ERROR: failed to download from $downloadUrl (status=$?)" + exit 3 + fi + +fi + +if [ ! -f "${LIMBO_SCHEMA_FILENAME}" ]; then + log "Downloading default schem file" + if ! curl -o "${LIMBO_SCHEMA_FILENAME}" -fsSL "${baseUrl}/artifact/${defaultSchemaPath}"; then + log "ERROR: failed to download schema file $baseUrl (status=$?)" + exit 3 + fi +fi + +if [[ ${LEVEL} != "*;*" ]]; then + LEVEL="${LEVEL};${LIMBO_SCHEMA_FILENAME}" +fi +export LEVEL + +export SKIP_LOG4J_CONFIG=true + +# Continue to Final Setup +exec ${SCRIPTS:-/}start-finalSetupWorld $@