mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-09-23 14:10:30 +00:00
Download and use Magma server jar rather than installer (#1618)
This commit is contained in:
@@ -2,7 +2,7 @@ version: "3.8"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
mc:
|
mc:
|
||||||
image: itzg/minecraft-server
|
image: itzg/minecraft-server:java8
|
||||||
tty: true
|
tty: true
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
ports:
|
ports:
|
||||||
@@ -10,7 +10,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
EULA: "TRUE"
|
EULA: "TRUE"
|
||||||
TYPE: MAGMA
|
TYPE: MAGMA
|
||||||
VERSION: 1.18.2
|
VERSION: 1.16.5
|
||||||
volumes:
|
volumes:
|
||||||
- data:/data
|
- data:/data
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -6,58 +6,17 @@ isDebugging && set -x
|
|||||||
|
|
||||||
: "${VANILLA_VERSION?}"
|
: "${VANILLA_VERSION?}"
|
||||||
|
|
||||||
magmaHandleInstaller() {
|
if ! downloadUrl=$(get --json-path '$.link' "https://api.magmafoundation.org/api/v2/${VANILLA_VERSION}/latest"); then
|
||||||
url=${1?}
|
log "ERROR failed to locate latest Magma download for ${VANILLA_VERSION}. Is that version supported?"
|
||||||
tagName=${2?}
|
|
||||||
markerFile=${3?}
|
|
||||||
|
|
||||||
installerFile="magma-installer-${VANILLA_VERSION}-${tagName}.jar"
|
|
||||||
log "Downloading Magma installer file for ${VANILLA_VERSION} @ ${tagName}"
|
|
||||||
if ! curl -o "$installerFile" -fsSL "$url"; then
|
|
||||||
log "ERROR failed to download Magma installer from $url (status=$?)"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "forge" > "$markerFile"
|
|
||||||
|
|
||||||
export FORGE_INSTALLER="$installerFile"
|
|
||||||
export FORGE_INSTALLER_CUSTOM_VERSION="$tagName"
|
|
||||||
|
|
||||||
# now hand off the rest to forge
|
|
||||||
exec ${SCRIPTS:-/}start-deployForge "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
latestMeta=$(curl -fsSL https://api.magmafoundation.org/api/v2/${VANILLA_VERSION}/latest || exit $?)
|
|
||||||
if [ $? != 0 ]; then
|
|
||||||
log "ERROR failed to locate latest Magma info for ${VANILLA_VERSION} (error=$?)"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tagName=$(echo "${latestMeta}" | jq -r '.tag_name')
|
if ! SERVER=$(get --output-filename --skip-up-to-date --output /data "$downloadUrl"); then
|
||||||
markerFile=".magma-installed-${VANILLA_VERSION}-${tagName}"
|
log "ERROR: failed to download Magma server jar from $downloadUrl"
|
||||||
if [ -f "${markerFile}" ]; then
|
exit 1
|
||||||
installedTagName=$(cat "${markerFile}")
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f "${markerFile}" ]; then
|
|
||||||
assetUrl=$(echo "${latestMeta}" | jq -r ".installer_link")
|
|
||||||
if [ $? != 0 ] || [ -z "$assetUrl" ]; then
|
|
||||||
log "ERROR failed to extract installer for ${VANILLA_VERSION} tag ${tagName}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
magmaHandleInstaller "$assetUrl" "$tagName" "$markerFile"
|
|
||||||
else
|
|
||||||
export SERVER=$(cat "${markerFile}")
|
|
||||||
|
|
||||||
if [[ $SERVER == "forge" ]]; then
|
|
||||||
export FORGE_INSTALLER="magma-installer-${VANILLA_VERSION}-${tagName}.jar"
|
|
||||||
export FORGE_INSTALLER_CUSTOM_VERSION="$tagName"
|
|
||||||
# now hand off the rest to forge
|
|
||||||
exec ${SCRIPTS:-/}start-deployForge "$@"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export SERVER
|
||||||
export FAMILY=HYBRID
|
export FAMILY=HYBRID
|
||||||
|
|
||||||
exec "${SCRIPTS:-/}start-setupWorld" "$@"
|
exec "${SCRIPTS:-/}start-setupWorld" "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user