docker-minecraft-server/scripts/start-deployPufferfish
Mathéo CIMBARO 23c8fc65a4
Added support for Pufferfish 1.19 (#1566)
* Added support for Pufferfish 1.19

* Update scripts/start-deployPufferfish

Co-authored-by: Geoff Bourne <itzgeoff@gmail.com>

* Removed wrong negation

Co-authored-by: Geoff Bourne <itzgeoff@gmail.com>
2022-06-16 15:19:04 -05:00

45 lines
1.6 KiB
Bash
Executable file

#!/bin/bash
# shellcheck source=start-utils
. "${SCRIPTS:-/}start-utils"
set -euo pipefail
isDebugging && set -x
IFS=$'\n\t'
if versionLessThan 1.17; then
log "ERROR: Pufferfish server type only supports versions 1.17, 1.18 or 1.19, use PUFFERFISH_BUILD to select the the correct build 47 => 1.18.1, 50 => 1.18.2 etc"
exit 1
fi
: "${PUFFERFISH_BUILD:=lastSuccessfulBuild}"
PUFFERFISH_BUILD_JSON=$(curl -X GET -s "https://ci.pufferfish.host/job/Pufferfish-${MAJOR_VANILLA_VERSION}/${PUFFERFISH_BUILD}/api/json")
# Example: "url": "https://ci.pufferfish.host/job/Pufferfish-1.18/50/",
PUFFERFISH_BUILD_URL=$(jq -n "$PUFFERFISH_BUILD_JSON" | jq -jc '.url // empty' )
# Example: "fileName": "pufferfish-paperclip-1.18.2-R0.1-SNAPSHOT-reobf.jar",
PUFFERFISH_BUILD_FILENAME=$(jq -n "$PUFFERFISH_BUILD_JSON" | jq -jc '.artifacts[].fileName // empty' )
PUFFERFISH_BUILD_DOWNLOAD_URL="${PUFFERFISH_BUILD_URL}artifact/build/libs/${PUFFERFISH_BUILD_FILENAME}"
# Setting server to the Jar filename for export.
export SERVER=$PUFFERFISH_BUILD_FILENAME
log "Removing old Pufferfish versions ..."
shopt -s nullglob
for f in pufferfish-*.jar; do
[[ $f != "$SERVER" ]] && rm "$f"
done
if [[ ! -f "$SERVER" ]] || isTrue "${FORCE_REDOWNLOAD:-false}"; then
log "Downloading Pufferfish from $PUFFERFISH_BUILD_DOWNLOAD_URL ..."
if ! get -o "$SERVER" "$PUFFERFISH_BUILD_DOWNLOAD_URL"; then
log "ERROR: failed to download from $PUFFERFISH_BUILD_DOWNLOAD_URL (status=$?)"
exit 3
fi
fi
# Normalize on Spigot for later operations
export FAMILY=SPIGOT
exec "${SCRIPTS:-/}start-spiget" "$@"