2019-01-14 01:00:34 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-06-24 16:38:15 +00:00
|
|
|
: "${CUSTOM_SERVER:=}"
|
|
|
|
: "${GENERIC_PACK:=}"
|
|
|
|
: "${CUSTOM_JAR_EXEC:=}"
|
|
|
|
|
2022-01-29 20:53:34 +00:00
|
|
|
# shellcheck source=start-utils
|
|
|
|
. "${SCRIPTS:-/}start-utils"
|
2021-03-11 22:29:21 +00:00
|
|
|
isDebugging && set -x
|
2019-01-14 01:00:34 +00:00
|
|
|
|
2023-06-24 16:38:15 +00:00
|
|
|
if isURL "${CUSTOM_SERVER}"; then
|
|
|
|
filename=$(basename "${CUSTOM_SERVER}")
|
2019-01-14 01:00:34 +00:00
|
|
|
export SERVER=/data/${filename}
|
|
|
|
|
2023-12-15 12:40:05 +00:00
|
|
|
if [[ -f ${SERVER} ]] && ! isTrue "$FORCE_REDOWNLOAD"; then
|
2020-03-06 15:52:17 +00:00
|
|
|
log "Using previously downloaded jar at ${SERVER}"
|
2019-01-14 01:00:34 +00:00
|
|
|
else
|
2020-03-06 15:52:17 +00:00
|
|
|
log "Downloading custom server jar from ${CUSTOM_SERVER} ..."
|
2023-06-24 16:38:15 +00:00
|
|
|
if ! curl -sSL -o "${SERVER}" "${CUSTOM_SERVER}"; then
|
2020-03-06 15:52:17 +00:00
|
|
|
log "Failed to download from ${CUSTOM_SERVER}"
|
2019-01-14 01:00:34 +00:00
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
elif [[ -f ${CUSTOM_SERVER} ]]; then
|
2020-12-29 16:56:05 +00:00
|
|
|
export SERVER=${CUSTOM_SERVER}
|
|
|
|
|
|
|
|
elif [[ ${GENERIC_PACK} ]]; then
|
|
|
|
log "Using custom server jar from generic pack at ${CUSTOM_SERVER} ..."
|
2019-01-14 01:00:34 +00:00
|
|
|
export SERVER=${CUSTOM_SERVER}
|
|
|
|
|
2023-06-24 16:38:15 +00:00
|
|
|
elif [[ ${CUSTOM_JAR_EXEC} ]]; then
|
|
|
|
log "CUSTOM_JAR_EXEC is in use, so \$SERVER will not be set"
|
|
|
|
|
2019-01-14 01:00:34 +00:00
|
|
|
else
|
2020-03-06 15:52:17 +00:00
|
|
|
log "CUSTOM_SERVER is not properly set to a URL or existing jar file"
|
2019-01-14 01:00:34 +00:00
|
|
|
exit 2
|
2020-12-29 16:56:05 +00:00
|
|
|
|
2019-01-14 01:00:34 +00:00
|
|
|
fi
|
|
|
|
|
2022-02-09 01:24:38 +00:00
|
|
|
# Allow for overriding Family on custom for testing.
|
|
|
|
export FAMILY="${FAMILY:-HYBRID}"
|
2022-01-29 20:53:34 +00:00
|
|
|
|
2023-06-24 16:38:15 +00:00
|
|
|
exec "${SCRIPTS:-/}start-setupWorld" "$@"
|