2021-02-07 17:22:08 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
IFS=$'\n\t'
|
|
|
|
|
2023-06-14 02:35:09 +00:00
|
|
|
: "${PURPUR_BUILD:=LATEST}"
|
2022-06-16 13:39:25 +00:00
|
|
|
: "${PURPUR_DOWNLOAD_URL:=}"
|
|
|
|
|
2022-01-02 16:17:32 +00:00
|
|
|
# shellcheck source=start-utils
|
|
|
|
. "${SCRIPTS:-/}start-utils"
|
2021-02-07 17:22:08 +00:00
|
|
|
isDebugging && set -x
|
|
|
|
|
2023-06-14 02:35:09 +00:00
|
|
|
resultsFile=/data/.purpur.env
|
2022-06-15 11:51:41 +00:00
|
|
|
|
2023-06-14 02:35:09 +00:00
|
|
|
if [[ $PURPUR_DOWNLOAD_URL ]]; then
|
|
|
|
if ! mc-image-helper install-purpur \
|
|
|
|
--output-directory=/data \
|
|
|
|
--results-file="$resultsFile" \
|
|
|
|
--url="$PURPUR_DOWNLOAD_URL}"; then
|
|
|
|
log "ERROR: failed to download from custom Purpur URL"
|
|
|
|
exit 1
|
2021-02-07 17:22:08 +00:00
|
|
|
fi
|
2023-06-14 02:35:09 +00:00
|
|
|
# grab SERVER and export it
|
|
|
|
set -a
|
|
|
|
# shellcheck disable=SC1090
|
|
|
|
source "${resultsFile}"
|
|
|
|
set +a
|
2021-02-07 17:22:08 +00:00
|
|
|
|
2022-06-15 11:51:41 +00:00
|
|
|
else
|
2023-06-14 02:35:09 +00:00
|
|
|
args=(
|
|
|
|
--output-directory=/data
|
|
|
|
--results-file="$resultsFile"
|
|
|
|
--version="$VERSION"
|
|
|
|
)
|
|
|
|
if [[ $PURPUR_BUILD ]]; then
|
|
|
|
args+=(--build="$PURPUR_BUILD")
|
2022-06-15 11:51:41 +00:00
|
|
|
fi
|
2023-06-14 02:35:09 +00:00
|
|
|
if ! mc-image-helper install-purpur "${args[@]}"; then
|
|
|
|
log "ERROR: failed to download Purpur"
|
|
|
|
exit 1
|
2022-06-15 11:51:41 +00:00
|
|
|
fi
|
2023-06-14 02:35:09 +00:00
|
|
|
# grab SERVER and export it
|
|
|
|
set -a
|
|
|
|
# shellcheck disable=SC1090
|
|
|
|
source "${resultsFile}"
|
|
|
|
set +a
|
2021-02-07 17:22:08 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Normalize on Spigot for later operations
|
2021-12-11 02:50:40 +00:00
|
|
|
export FAMILY=SPIGOT
|
2021-02-07 17:22:08 +00:00
|
|
|
|
2022-01-02 16:17:32 +00:00
|
|
|
exec "${SCRIPTS:-/}start-spiget" "$@"
|