From 8f82ff9b1d43c7e06d0e137a2e3a1855afe08273 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 20 Jun 2020 15:28:21 -0500 Subject: [PATCH] Added support for Catserver type --- DEVELOPMENT.md | 2 +- README.md | 9 +++++++++ start-configuration | 4 ++++ start-deployCatserver | 32 ++++++++++++++++++++++++++++++++ start-deployMohist | 2 +- 5 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 start-deployCatserver diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 2012f2f2..9076767b 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -22,7 +22,7 @@ docker build -t mc-dev . Using the baseline image, an interactive container can be started to iteratively run the scripts to be developed. By attaching the current workspace directory, you can use the local editor of your choice to iteratively modify scripts while using the container to run them. ```shell script -docker run -it --rm -v ${PWD}:/scripts -e SCRIPTS=/scripts/ --entrypoint bash mc-dev +docker run -it --rm -v ${PWD}:/scripts -e SCRIPTS=/scripts/ --entrypoint bash mc-dev ``` From within the container you can run individual scripts via the attached `/scripts/` path; however, be sure to set any environment variables expected by the scripts by either `export`ing them manually: diff --git a/README.md b/README.md index da9fdbeb..0f5d1b93 100644 --- a/README.md +++ b/README.md @@ -534,6 +534,15 @@ A [Mohist](https://github.com/Mohist-Community/Mohist) server can be used with > **NOTE** there are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2" + +## Running a Catserver type server + +A [Catserver](http://catserver.moe/) type server can be used with + + -e TYPE=CATSERVER + +> **NOTE** Catserver only provides a single release stream, so `VERSION` is ignored + ## Running a server with a Feed the Beast modpack > **NOTE** requires `itzg/minecraft-server:multiarch` image diff --git a/start-configuration b/start-configuration index f5f9e23a..223c9df1 100644 --- a/start-configuration +++ b/start-configuration @@ -123,6 +123,10 @@ case "${TYPE^^}" in exec ${SCRIPTS:-/}start-deployMohist "$@" ;; + CATSERVER) + exec ${SCRIPTS:-/}start-deployCatserver "$@" + ;; + *) log "Invalid type: '$TYPE'" log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTB, CURSEFORGE, SPONGEVANILLA" diff --git a/start-deployCatserver b/start-deployCatserver new file mode 100644 index 00000000..ce9ea6cd --- /dev/null +++ b/start-deployCatserver @@ -0,0 +1,32 @@ +#!/bin/bash + +. ${SCRIPTS:-/}start-utils +set -o pipefail +set -e + +latestAsset=$( + curl -fsSL https://api.github.com/repos/Luohuayu/CatServer/releases/latest | \ + jq '.assets[] | select(.name | match(".*-universal.jar"))' +) + +if [[ -z "${latestAsset}" ]]; then + log "ERROR: latest release of Catserver is missing universal.jar asset" + exit 1 +fi + +isDebugging && log "Latest asset ${latestAsset}" +latestJarName=$(echo ${latestAsset} | jq --raw-output '.name') +latestJarId=$(echo ${latestAsset} | jq --raw-output '.id') + + +export SERVER="/data/${latestJarName}" + +if [ ! -f ${SERVER} ]; then + log "Downloading ${latestJarName}" + curl -H "Accept:application/octet-stream" -o "$SERVER" -fsSL https://api.github.com/repos/Luohuayu/CatServer/releases/assets/${latestJarId} +fi + +export SKIP_LOG4J_CONFIG=true + +# Continue to Final Setup +exec ${SCRIPTS:-/}start-finalSetup01World "$@" diff --git a/start-deployMohist b/start-deployMohist index b6178e8a..9a0ca008 100644 --- a/start-deployMohist +++ b/start-deployMohist @@ -33,7 +33,7 @@ fi export SERVER="/data/${baseName}" if [ ! -f ${SERVER} ]; then - log "Downloading ${SERVER}" + log "Downloading ${baseName}" curl -o "${SERVER}" -fsSL "${mohistJob}lastSuccessfulBuild/artifact/${latestBuildRelPath}" fi