mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
Corrected support for Magma dev channel forge-based installer
This commit is contained in:
parent
17099320e9
commit
4d7e29cb3a
@ -472,7 +472,7 @@ A [Magma](https://magmafoundation.org/) server, which is a combination of Forge
|
||||
|
||||
By default, the "stable" channel is used, but you can set `MAGMA_CHANNEL` to "dev" to access dev channel versions.
|
||||
|
||||
> **NOTE** there are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2", ""
|
||||
> **NOTE** there are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2", "1.16.5", etc.
|
||||
|
||||
|
||||
### Running a Mohist server
|
||||
|
@ -1,7 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
. ${SCRIPTS:-/}start-utils
|
||||
export TYPE=FORGE
|
||||
: ${FORGEVERSION:=RECOMMENDED}
|
||||
isDebugging && set -x
|
||||
|
||||
@ -47,7 +46,7 @@ elif [[ ! -e $FORGE_INSTALLER ]]; then
|
||||
log "ERROR: the given Forge installer doesn't exist : $FORGE_INSTALLER"
|
||||
exit 2
|
||||
else
|
||||
shortForgeVersion=$VANILLA_VERSION-custom
|
||||
shortForgeVersion=$VANILLA_VERSION-${FORGE_INSTALLER_CUSTOM_VERSION:-custom}
|
||||
fi
|
||||
|
||||
installMarker="/data/.forge-installed-$shortForgeVersion"
|
||||
|
@ -1,23 +1,93 @@
|
||||
#!/bin/bash
|
||||
|
||||
. ${SCRIPTS:-/}start-utils
|
||||
export SKIP_LOG4J_CONFIG=true
|
||||
|
||||
isDebugging && set -x
|
||||
|
||||
: ${VANILLA_VERSION?}
|
||||
# stable, dev
|
||||
: ${MAGMA_CHANNEL:=stable}
|
||||
|
||||
export SERVER="/data/magma-server-${VANILLA_VERSION}.jar"
|
||||
|
||||
# Always download since new updates of each base version are published frequently
|
||||
if ! curl -o /data/magma-server-${VANILLA_VERSION}.jar -fsSL \
|
||||
https://api.magmafoundation.org/api/resources/Magma/${VANILLA_VERSION}/${MAGMA_CHANNEL}/latest/download; then
|
||||
log "ERROR unable to download version ${VANILLA_VERSION} of Magma in ${MAGMA_CHANNEL} channel"
|
||||
log " Check https://magmafoundation.org/ for available versions"
|
||||
magmaDownloadServer() {
|
||||
url=${1?}
|
||||
tagName=${2?}
|
||||
markerFile=${3?}
|
||||
|
||||
export SERVER="/data/magma-server-${VANILLA_VERSION}.jar"
|
||||
|
||||
log "Downloading Magma server file for ${VANILLA_VERSION} @ ${tagName}"
|
||||
if ! curl -o /data/magma-server-${VANILLA_VERSION}.jar -fsSL "$url"; then
|
||||
log "ERROR failed to download Magma server from $url (status=$?)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -n "$SERVER" > "$markerFile"
|
||||
}
|
||||
|
||||
magmaHandleInstaller() {
|
||||
url=${1?}
|
||||
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/resources/Magma/${VANILLA_VERSION}/${MAGMA_CHANNEL}/latest || exit $?)
|
||||
if [ $? != 0 ]; then
|
||||
log "ERROR failed to locate latest Magma info for ${VANILLA_VERSION} in channel ${MAGMA_CHANNEL} (error=$?)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export SKIP_LOG4J_CONFIG=true
|
||||
tagName=$(echo "${latestMeta}" | jq -r '.tag_name')
|
||||
markerFile=".magma-installed-${VANILLA_VERSION}-${tagName}"
|
||||
if [ -f "${markerFile}" ]; then
|
||||
installedTagName=$(cat "${markerFile}")
|
||||
fi
|
||||
|
||||
if [ ! -f "${markerFile}" ]; then
|
||||
|
||||
if versionLessThan 1.16; then
|
||||
assetType=server
|
||||
else
|
||||
assetType=installer
|
||||
fi
|
||||
|
||||
assetUrl=$(echo "${latestMeta}" | jq -r ".assets | .[].browser_download_url | select(test(\"${assetType}\"))")
|
||||
if [ $? != 0 ] || [ -z "$assetUrl" ]; then
|
||||
log "ERROR failed to extract ${assetType} asset type for ${VANILLA_VERSION} in channel ${MAGMA_CHANNEL}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ${assetType} = server ]]; then
|
||||
magmaDownloadServer "$assetUrl" "$tagName" "$markerFile"
|
||||
else
|
||||
magmaHandleInstaller "$assetUrl" "$tagName" "$markerFile"
|
||||
fi
|
||||
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
|
||||
|
||||
# Continue to Final Setup
|
||||
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||
|
Loading…
Reference in New Issue
Block a user