2021-04-08 23:50:06 +00:00
#!/bin/bash
. ${SCRIPTS:-/}start-utils
2021-12-11 18:56:11 +00:00
set -euo pipefail
2021-04-08 23:50:06 +00:00
isDebugging && set -x
2021-12-11 18:56:11 +00:00
IFS=$'\n\t'
2021-07-13 00:03:17 +00:00
if [ "${VERSION}" != "LATEST" ] && [ "${VERSION}" != "1.16" ] && [ "${VERSION}" != "1.17" ] && [ "${VERSION}" != "PURPUR" ] && [ "${VERSION}" != "PURPUR-1.16" ] ; then
log "ERROR: Airplane server type only supports VERSION=LATEST, VERSION=1.17, VERSION=1.16, VERSION=PURPUR or VERSION=PURPUR-1.16. Note that these are branches, not #.#.# versions."
2021-06-24 03:29:58 +00:00
exit 1
fi
: ${AIRPLANE_BUILD:=lastSuccessfulBuild}
2021-07-21 15:16:05 +00:00
: ${AIRPLANE_TYPE:=airplane}
2021-04-08 23:50:06 +00:00
2021-07-13 00:03:17 +00:00
if [ "${VERSION}" = "LATEST" ] || [ "${VERSION}" = "1.17" ]; then
2021-06-24 03:29:58 +00:00
AIRPLANE_BRANCH="1.17"
fi
2021-07-13 00:03:17 +00:00
if [ "${VERSION}" = "1.16" ]; then
AIRPLANE_BRANCH="1.16"
2021-07-08 22:56:06 +00:00
fi
2021-06-24 03:29:58 +00:00
if [ "${VERSION}" = "PURPUR" ]; then
2021-07-13 00:03:17 +00:00
AIRPLANE_BRANCH="Purpur-1.17"
2021-07-21 15:16:05 +00:00
AIRPLANE_TYPE="airplanepurpur"
2021-07-13 00:03:17 +00:00
fi
if [ "${VERSION}" = "PURPUR-1.16" ]; then
2021-06-24 12:46:40 +00:00
AIRPLANE_BRANCH="Purpur-1.16"
2021-07-21 15:16:05 +00:00
AIRPLANE_TYPE="airplanepurpur"
2021-04-08 23:50:06 +00:00
fi
2021-06-24 12:46:40 +00:00
log "Using Airplane-${AIRPLANE_BRANCH} branch"
2021-06-24 03:29:58 +00:00
export SERVER=airplane-${AIRPLANE_BRANCH}-${AIRPLANE_BUILD}.jar
2021-04-08 23:50:06 +00:00
2021-12-11 18:56:11 +00:00
log "Removing old Airplane versions ..."
shopt -s nullglob
for f in airplane-*.jar; do
[[ $f != $SERVER ]] && rm $f
done
2021-07-16 12:26:49 +00:00
if [ ! -f "$SERVER" ] || isTrue "${FORCE_REDOWNLOAD:-false}"; then
2021-07-21 15:16:05 +00:00
downloadUrl="https://ci.tivy.ca/job/Airplane-${AIRPLANE_BRANCH}/${AIRPLANE_BUILD}/artifact/launcher-${AIRPLANE_TYPE}.jar"
2021-04-08 23:50:06 +00:00
log "Downloading Airplane from $downloadUrl ..."
curl -fsSL -o "$SERVER" "$downloadUrl"
if [ ! -f "$SERVER" ]; then
log "ERROR: failed to download from $downloadUrl (status=$?)"
exit 3
fi
fi
# Normalize on Spigot for later operations
export TYPE=SPIGOT
2021-12-11 02:50:40 +00:00
export FAMILY=SPIGOT
2021-04-08 23:50:06 +00:00
export SKIP_LOG4J_CONFIG=true
2021-04-13 01:21:53 +00:00
exec ${SCRIPTS:-/}start-spiget "$@"