docker-minecraft-server/start-deployMohist
2021-09-15 21:37:10 -05:00

43 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
. ${SCRIPTS:-/}start-utils
set -o pipefail
set -e
isDebugging && set -x
requireVar VANILLA_VERSION
: ${MOHIST_BUILD:=lastSuccessfulBuild}
mohistJobs=https://ci.codemc.io/job/MohistMC/job/
mohistJob=${mohistJobs}Mohist-${VANILLA_VERSION}/
if ! curl -X HEAD -o /dev/null -fsSL "${mohistJob}"; then
log "ERROR: mohist builds do not exist for ${VANILLA_VERSION}"
log " check https://ci.codemc.io/job/MohistMC/ for available versions"
log " and set VERSION accordingly"
exit 1
fi
buildRelPath=$(
curl -fsSL "${mohistJob}${MOHIST_BUILD}/api/json" |
jq -r '.artifacts[0].relativePath'
)
baseName=$(basename "${buildRelPath}")
if [[ ${baseName} != *-server.jar* ]]; then
log "ERROR: mohist build for ${VANILLA_VERSION} is not a valid server jar, found ${baseName}"
log " check https://ci.codemc.io/job/MohistMC/ for available versions"
log " and set VERSION accordingly"
exit 1
fi
export SERVER="/data/${baseName}"
if [ ! -f ${SERVER} ]; then
log "Downloading ${baseName}"
curl -o "${SERVER}" -fsSL "${mohistJob}${MOHIST_BUILD}/artifact/${buildRelPath}"
fi
export SKIP_LOG4J_CONFIG=true
exec ${SCRIPTS:-/}start-setupWorld "$@"