docker-minecraft-server/scripts/start-deployFabric

51 lines
1.7 KiB
Text
Raw Normal View History

2019-07-10 03:19:59 +00:00
#!/bin/bash
2019-09-15 14:54:13 +00:00
set -eu
# shellcheck source=start-utils
. "${SCRIPTS:-/}start-utils"
2019-07-10 03:19:59 +00:00
requireVar VANILLA_VERSION
2019-07-10 03:19:59 +00:00
export TYPE=FABRIC
: "${FABRIC_LAUNCHER_VERSION:=${FABRIC_INSTALLER_VERSION:-LATEST}}"
: "${FABRIC_LAUNCHER:=}"
: "${FABRIC_LAUNCHER_URL:=}"
: "${FABRIC_LOADER_VERSION:=LATEST}"
2019-07-10 03:19:59 +00:00
isDebugging && set -x
2019-07-10 03:19:59 +00:00
# Custom fabric jar
if [[ $FABRIC_LAUNCHER ]]; then
export SERVER=${FABRIC_LAUNCHER}
# Custom fabric jar url
elif [[ $FABRIC_LAUNCHER_URL ]]; then
export SERVER=fabric-server-$(echo -n "$FABRIC_LAUNCHER_URL" | mc-image-helper hash)
# Official fabric launcher
else
if [[ ${FABRIC_LAUNCHER_VERSION^^} = LATEST ]]; then
log "Checking Fabric Launcher version information."
FABRIC_LAUNCHER_VERSION=$(maven-metadata-release https://maven.fabricmc.net/net/fabricmc/fabric-installer/maven-metadata.xml)
fi
if [[ ${FABRIC_LOADER_VERSION^^} = LATEST ]]; then
log "Checking Fabric Loader version information."
FABRIC_LOADER_VERSION=$(maven-metadata-release https://maven.fabricmc.net/net/fabricmc/fabric-loader/maven-metadata.xml)
fi
export SERVER=fabric-server-mc.${VANILLA_VERSION}-loader.${FABRIC_LOADER_VERSION}-launcher.${FABRIC_LAUNCHER_VERSION}.jar
export FABRIC_LAUNCHER_URL="https://meta.fabricmc.net/v2/versions/loader/${VANILLA_VERSION}/${FABRIC_LOADER_VERSION}/${FABRIC_LAUNCHER_VERSION}/server/jar"
fi
if [[ ! -e ${SERVER} && ! -z ${FABRIC_LAUNCHER_URL} ]]; then
log "Downloading $FABRIC_LAUNCHER_URL ..."
if ! get -o "$SERVER" "$FABRIC_LAUNCHER_URL"; then
log "Failed to download from given location $FABRIC_LAUNCHER_URL"
exit 2
2019-07-10 03:19:59 +00:00
fi
fi
if [[ ! -e ${SERVER} ]]; then
log "$SERVER does not exist, cannot launch server!"
exit 1
fi
export FAMILY=FABRIC
exec "${SCRIPTS:-/}start-setupWorld" "$@"