mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-11-10 14:24:28 +00:00
37 lines
1.1 KiB
Bash
Executable file
37 lines
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
set -euo pipefail
|
|
IFS=$'\n\t'
|
|
|
|
. ${SCRIPTS:-/}start-utils
|
|
isDebugging && set -x
|
|
|
|
: ${VANILLA_VERSION:?}
|
|
: ${PURPUR_BUILD:=LATEST}
|
|
: ${FORCE_REDOWNLOAD:=false}
|
|
|
|
if [[ ${PURPUR_BUILD} == LATEST ]]; then
|
|
PURPUR_BUILD=$(curl -fsSL "https://purpur.pl3x.net/api/v1/purpur/${VANILLA_VERSION}" |
|
|
jq -r '.builds.latest' || echo "")
|
|
if [[ -z ${PURPUR_BUILD} ]]; then
|
|
log "ERROR: Failed to locate a Purpur build for ${VANILLA_VERSION}."
|
|
log " Please check if a download is available at https://purpur.pl3x.net/downloads/"
|
|
exit 3
|
|
fi
|
|
fi
|
|
|
|
export SERVER="purpur-${VANILLA_VERSION}-${PURPUR_BUILD}.jar"
|
|
|
|
if [ ! -f "$SERVER" ] || isTrue "$FORCE_REDOWNLOAD"; then
|
|
downloadUrl="https://purpur.pl3x.net/api/v1/purpur/${VANILLA_VERSION}/${PURPUR_BUILD}/download"
|
|
log "Downloading Purpur from $downloadUrl ..."
|
|
if ! curl -fsSL -o "$SERVER" "$downloadUrl"; then
|
|
log "ERROR: failed to download from $downloadUrl (status=$?)"
|
|
exit 3
|
|
fi
|
|
fi
|
|
|
|
# Normalize on Spigot for later operations
|
|
export TYPE=SPIGOT
|
|
export SKIP_LOG4J_CONFIG=true
|
|
|
|
exec ${SCRIPTS:-/}start-spiget "$@"
|