2020-06-19 16:31:56 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-10-17 03:09:44 +00:00
|
|
|
# shellcheck source=start-utils
|
|
|
|
. "${SCRIPTS:-$(dirname "$0")}/start-utils"
|
2020-06-19 16:31:56 +00:00
|
|
|
set -o pipefail
|
|
|
|
set -e
|
|
|
|
isDebugging && set -x
|
|
|
|
|
2023-06-17 18:00:22 +00:00
|
|
|
resolveVersion
|
2021-10-17 03:09:44 +00:00
|
|
|
: "${MOHIST_BUILD:=lastSuccessfulBuild}"
|
2020-06-19 20:34:56 +00:00
|
|
|
|
2021-05-22 03:05:22 +00:00
|
|
|
mohistJobs=https://ci.codemc.io/job/MohistMC/job/
|
2023-06-17 18:00:22 +00:00
|
|
|
mohistJob=${mohistJobs}Mohist-${VERSION}/
|
2020-06-19 16:31:56 +00:00
|
|
|
|
2021-10-17 03:09:44 +00:00
|
|
|
if ! get --exists "${mohistJob}"; then
|
2023-06-17 18:00:22 +00:00
|
|
|
log "ERROR: mohist builds do not exist for ${VERSION}"
|
2021-05-22 03:05:22 +00:00
|
|
|
log " check https://ci.codemc.io/job/MohistMC/ for available versions"
|
2020-06-20 14:07:38 +00:00
|
|
|
log " and set VERSION accordingly"
|
2020-06-19 16:31:56 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-02-28 02:37:59 +00:00
|
|
|
buildRelPath=$(
|
2021-10-17 03:09:44 +00:00
|
|
|
get --json-path '$.artifacts[0].relativePath' "${mohistJob}${MOHIST_BUILD}/api/json"
|
2020-06-19 16:31:56 +00:00
|
|
|
)
|
|
|
|
|
2021-02-28 02:37:59 +00:00
|
|
|
baseName=$(basename "${buildRelPath}")
|
2020-06-19 16:31:56 +00:00
|
|
|
if [[ ${baseName} != *-server.jar* ]]; then
|
2023-06-17 18:00:22 +00:00
|
|
|
log "ERROR: mohist build for ${VERSION} is not a valid server jar, found ${baseName}"
|
2021-05-22 03:05:22 +00:00
|
|
|
log " check https://ci.codemc.io/job/MohistMC/ for available versions"
|
2020-06-20 14:07:38 +00:00
|
|
|
log " and set VERSION accordingly"
|
2020-06-19 16:31:56 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
export SERVER="/data/${baseName}"
|
|
|
|
|
2021-10-17 03:09:44 +00:00
|
|
|
if [ ! -f "${SERVER}" ]; then
|
2020-06-20 20:28:21 +00:00
|
|
|
log "Downloading ${baseName}"
|
2021-10-17 03:09:44 +00:00
|
|
|
get -o "${SERVER}" "${mohistJob}${MOHIST_BUILD}/artifact/${buildRelPath}"
|
2020-06-19 16:31:56 +00:00
|
|
|
fi
|
|
|
|
|
2021-12-11 02:50:40 +00:00
|
|
|
export FAMILY=HYBRID
|
2022-01-29 20:53:34 +00:00
|
|
|
|
2023-07-15 03:21:58 +00:00
|
|
|
exec "${SCRIPTS:-/}start-spiget" "$@"
|