2019-07-10 03:19:59 +00:00
|
|
|
#!/bin/bash
|
2019-09-15 14:54:13 +00:00
|
|
|
set -eu
|
|
|
|
|
2021-10-09 20:22:42 +00:00
|
|
|
# shellcheck source=start-utils
|
2021-12-12 21:34:24 +00:00
|
|
|
. "${SCRIPTS:-/}start-utils"
|
2019-07-10 03:19:59 +00:00
|
|
|
|
2021-07-10 19:56:10 +00:00
|
|
|
requireVar VANILLA_VERSION
|
2019-07-10 03:19:59 +00:00
|
|
|
export TYPE=FABRIC
|
2022-02-12 02:37:39 +00:00
|
|
|
: "${FABRIC_LAUNCHER_VERSION:=${FABRIC_INSTALLER_VERSION:-LATEST}}"
|
|
|
|
: "${FABRIC_LAUNCHER:=}"
|
|
|
|
: "${FABRIC_LAUNCHER_URL:=}"
|
2021-12-12 21:34:24 +00:00
|
|
|
: "${FABRIC_LOADER_VERSION:=LATEST}"
|
2019-07-10 03:19:59 +00:00
|
|
|
|
2021-07-10 19:56:10 +00:00
|
|
|
isDebugging && set -x
|
2019-07-10 03:19:59 +00:00
|
|
|
|
2022-02-12 02:37:39 +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)
|
2021-07-10 19:56:10 +00:00
|
|
|
fi
|
2022-02-12 02:37:39 +00:00
|
|
|
if [[ ${FABRIC_LOADER_VERSION^^} = LATEST ]]; then
|
2021-10-17 19:43:41 +00:00
|
|
|
log "Checking Fabric Loader version information."
|
|
|
|
FABRIC_LOADER_VERSION=$(maven-metadata-release https://maven.fabricmc.net/net/fabricmc/fabric-loader/maven-metadata.xml)
|
|
|
|
fi
|
2022-02-12 02:37:39 +00:00
|
|
|
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
|
2021-10-17 19:43:41 +00:00
|
|
|
|
2022-02-12 02:37:39 +00:00
|
|
|
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
|
|
|
|
|
2022-02-12 02:37:39 +00:00
|
|
|
if [[ ! -e ${SERVER} ]]; then
|
|
|
|
log "$SERVER does not exist, cannot launch server!"
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-12-13 19:50:20 +00:00
|
|
|
|
2021-12-11 02:50:40 +00:00
|
|
|
export FAMILY=FABRIC
|
2021-12-12 21:34:24 +00:00
|
|
|
exec "${SCRIPTS:-/}start-setupWorld" "$@"
|