2017-11-01 05:42:44 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-07-21 01:24:05 +00:00
|
|
|
# shellcheck source=start-utils
|
|
|
|
. "${SCRIPTS:-/}start-utils"
|
2020-08-15 15:02:45 +00:00
|
|
|
set -o pipefail
|
2022-07-21 01:24:05 +00:00
|
|
|
handleDebugMode
|
|
|
|
|
2023-06-13 14:24:37 +00:00
|
|
|
: "${PAPER_PROJECT:=paper}"
|
|
|
|
: "${PAPERBUILD:=}"
|
|
|
|
: "${PAPER_DOWNLOAD_URL:=}"
|
2022-07-21 01:24:05 +00:00
|
|
|
: "${PAPER_CUSTOM_JAR:=}"
|
2020-03-06 15:52:17 +00:00
|
|
|
|
2023-06-13 14:24:37 +00:00
|
|
|
resultsFile=/data/.paper.env
|
2022-07-21 01:24:05 +00:00
|
|
|
if [[ $PAPER_CUSTOM_JAR ]]; then
|
|
|
|
export SERVER="$PAPER_CUSTOM_JAR"
|
|
|
|
elif [[ $PAPER_DOWNLOAD_URL ]]; then
|
2023-06-13 14:24:37 +00:00
|
|
|
if ! mc-image-helper install-paper \
|
|
|
|
--output-directory=/data \
|
|
|
|
--results-file="$resultsFile" \
|
2023-06-14 12:15:02 +00:00
|
|
|
--url="$PAPER_DOWNLOAD_URL"; then
|
2023-06-13 14:24:37 +00:00
|
|
|
log "ERROR: failed to download from custom PaperMC URL"
|
|
|
|
exit 1
|
2020-12-16 02:39:49 +00:00
|
|
|
fi
|
2023-06-13 14:24:37 +00:00
|
|
|
# grab SERVER and export it
|
|
|
|
set -a
|
|
|
|
# shellcheck disable=SC1090
|
|
|
|
source "${resultsFile}"
|
|
|
|
set +a
|
2020-12-16 02:39:49 +00:00
|
|
|
|
|
|
|
else
|
2023-06-13 14:24:37 +00:00
|
|
|
args=(
|
|
|
|
--output-directory=/data
|
|
|
|
--results-file="$resultsFile"
|
|
|
|
--project="$PAPER_PROJECT"
|
|
|
|
--version="$VERSION"
|
|
|
|
)
|
|
|
|
if [[ $PAPERBUILD ]]; then
|
|
|
|
args+=(--build="$PAPERBUILD")
|
2023-06-10 17:51:49 +00:00
|
|
|
fi
|
2023-06-13 14:24:37 +00:00
|
|
|
if ! mc-image-helper install-paper "${args[@]}"; then
|
|
|
|
log "ERROR: failed to download $PAPER_PROJECT"
|
|
|
|
exit 1
|
2020-12-16 02:39:49 +00:00
|
|
|
fi
|
2023-06-13 14:24:37 +00:00
|
|
|
# grab SERVER and export it
|
|
|
|
set -a
|
|
|
|
# shellcheck disable=SC1090
|
|
|
|
source "${resultsFile}"
|
|
|
|
set +a
|
2020-11-25 21:42:27 +00:00
|
|
|
|
2020-09-16 22:09:16 +00:00
|
|
|
fi
|
2020-07-11 18:30:39 +00:00
|
|
|
|
|
|
|
# Normalize on Spigot for downstream operations
|
2021-12-11 02:50:40 +00:00
|
|
|
export FAMILY=SPIGOT
|
2017-11-01 05:42:44 +00:00
|
|
|
|
2023-06-10 17:51:49 +00:00
|
|
|
exec "${SCRIPTS:-/}start-spiget" "$@"
|