mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-02-17 07:03:57 +00:00
Skip Mohist lookup/download when MOHIST_BUILD provided and server jar exists (#3631)
This commit is contained in:
@@ -7,7 +7,7 @@ services:
|
|||||||
EULA: "TRUE"
|
EULA: "TRUE"
|
||||||
TYPE: MOHIST
|
TYPE: MOHIST
|
||||||
VERSION: 1.12.2
|
VERSION: 1.12.2
|
||||||
DEBUG: "true"
|
MOHIST_BUILD: 347
|
||||||
volumes:
|
volumes:
|
||||||
- data:/data
|
- data:/data
|
||||||
|
|
||||||
|
|||||||
@@ -14,38 +14,39 @@ mohistType="${TYPE,,}"
|
|||||||
mohistApiUrl="https://api.mohistmc.com/project/${mohistType}"
|
mohistApiUrl="https://api.mohistmc.com/project/${mohistType}"
|
||||||
mohistDownloadsPage="https://mohistmc.com/downloadSoftware?project=${mohistType}"
|
mohistDownloadsPage="https://mohistmc.com/downloadSoftware?project=${mohistType}"
|
||||||
|
|
||||||
if ! get --exists "${mohistApiUrl}/${VERSION}/builds"; then
|
if [[ "${MOHIST_BUILD}" != "lastSuccessfulBuild" ]] && [[ "${VERSION,,}" != latest ]] && [[ -f "/data/${mohistType}-${VERSION}-${MOHIST_BUILD}-server.jar" ]]; then
|
||||||
logError "${mohistType} builds do not exist for ${VERSION}"
|
log "Skipping Mohist build lookup since server jar exists"
|
||||||
logError " check ${mohistDownloadsPage} for available versions"
|
SERVER="/data/${mohistType}-${VERSION}-${MOHIST_BUILD}-server.jar"
|
||||||
logError " and set VERSION accordingly"
|
else
|
||||||
exit 1
|
if ! get --exists "${mohistApiUrl}/${VERSION}/builds"; then
|
||||||
fi
|
logError "${mohistType} builds do not exist for ${VERSION}"
|
||||||
|
logError " check ${mohistDownloadsPage} for available versions"
|
||||||
if [[ "${MOHIST_BUILD}" == "lastSuccessfulBuild" ]]; then
|
logError " and set VERSION accordingly"
|
||||||
# Get the latest build number from the API
|
|
||||||
if ! buildNumber=$(
|
|
||||||
get --json-path '$[0].id' "${mohistApiUrl}/${VERSION}/builds"
|
|
||||||
); then
|
|
||||||
logError "failed to list ${mohistType} builds for ${VERSION}"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
MOHIST_BUILD="${buildNumber}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
downloadUrl="${mohistApiUrl}/${VERSION}/builds/${MOHIST_BUILD}/download"
|
if [[ "${MOHIST_BUILD}" == "lastSuccessfulBuild" ]]; then
|
||||||
|
# Get the latest build number from the API
|
||||||
|
if ! buildNumber=$(
|
||||||
|
get --json-path '$[0].id' "${mohistApiUrl}/${VERSION}/builds"
|
||||||
|
); then
|
||||||
|
logError "failed to list ${mohistType} builds for ${VERSION}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
MOHIST_BUILD="${buildNumber}"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -z "${downloadUrl}" ]]; then
|
downloadUrl="${mohistApiUrl}/${VERSION}/builds/${MOHIST_BUILD}/download"
|
||||||
logError "Could not find build ${MOHIST_BUILD} for version ${VERSION}"
|
|
||||||
logError " check ${mohistDownloadsPage} for available versions"
|
|
||||||
logError " and set VERSION accordingly"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
SERVER="/data/${mohistType}-${VERSION}-${MOHIST_BUILD}-server.jar"
|
if [[ -z "${downloadUrl}" ]]; then
|
||||||
|
logError "Could not find build ${MOHIST_BUILD} for version ${VERSION}"
|
||||||
|
logError " check ${mohistDownloadsPage} for available versions"
|
||||||
|
logError " and set VERSION accordingly"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -f "${SERVER}" ]; then
|
SERVER="/data/${mohistType}-${VERSION}-${MOHIST_BUILD}-server.jar"
|
||||||
log "Downloading ${mohistType^} build ${MOHIST_BUILD} for ${VERSION}"
|
get --skip-existing -o "${SERVER}" "${downloadUrl}"
|
||||||
get -o "${SERVER}" "${downloadUrl}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${mohistType}" == "mohist" ]]; then
|
if [[ "${mohistType}" == "mohist" ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user