mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-11-13 23:57:08 +00:00
60 lines
2.1 KiB
Bash
Executable file
60 lines
2.1 KiB
Bash
Executable file
#!/bin/bash
|
|
set -eu
|
|
|
|
# shellcheck source=start-utils
|
|
. "${SCRIPTS:-/}start-utils"
|
|
|
|
requireVar VANILLA_VERSION
|
|
export TYPE=QUILT
|
|
: "${QUILT_LAUNCHER:=}"
|
|
: "${QUILT_LAUNCHER_URL:=}"
|
|
: "${QUILT_INSTALLER_URL:=}"
|
|
: "${QUILT_INSTALLER_VERSION:=LATEST}"
|
|
: "${QUILT_LOADER_VERSION:=LATEST}"
|
|
|
|
isDebugging && set -x
|
|
|
|
# Custom quilt jar
|
|
if [[ $QUILT_LAUNCHER ]]; then
|
|
export SERVER=${QUILT_LAUNCHER}
|
|
# Custom quilt jar url
|
|
elif [[ $QUILT_LAUNCHER_URL ]]; then
|
|
export SERVER=quilt-server-$(echo -n "$QUILT_LAUNCHER_URL" | mc-image-helper hash)
|
|
# Official quilt installer
|
|
else
|
|
if [[ ${QUILT_INSTALLER_VERSION^^} = LATEST ]]; then
|
|
log "Checking Quilt Installer version information."
|
|
QUILT_INSTALLER_VERSION=$(maven-metadata-release https://maven.quiltmc.org/repository/release/org/quiltmc/quilt-installer/maven-metadata.xml)
|
|
fi
|
|
if [[ ${QUILT_LOADER_VERSION^^} = LATEST ]]; then
|
|
log "Checking Quilt Loader version information."
|
|
QUILT_LOADER_VERSION=$(maven-metadata-release https://maven.quiltmc.org/repository/release/org/quiltmc/quilt-loader/maven-metadata.xml)
|
|
fi
|
|
export INSTALLER=quilt-installer-${QUILT_INSTALLER_VERSION}.jar
|
|
export SERVER=quilt-server-${VANILLA_VERSION}-${QUILT_LOADER_VERSION}-launch.jar
|
|
export QUILT_INSTALLER_URL="https://maven.quiltmc.org/repository/release/org/quiltmc/quilt-installer/${QUILT_INSTALLER_VERSION}/quilt-installer-${QUILT_INSTALLER_VERSION}.jar"
|
|
fi
|
|
|
|
if [[ ! -e ${SERVER} && ! -z ${QUILT_INSTALLER_URL} ]]; then
|
|
log "Downloading and installing $QUILT_INSTALLER_URL ..."
|
|
if ! get -o "$INSTALLER" "$QUILT_INSTALLER_URL"; then
|
|
log "Failed to download from given location $QUILT_INSTALLER_URL"
|
|
exit 2
|
|
fi
|
|
if ! java -jar ${INSTALLER} install server ${VANILLA_VERSION} ${QUILT_LOADER_VERSION} --install-dir=./ --download-server; then
|
|
log "Failed to install $INSTALLER"
|
|
exit 2
|
|
fi
|
|
if ! mv quilt-server-launch.jar ${SERVER}; then
|
|
log "Failed to rename $SERVER"
|
|
exit 2
|
|
fi
|
|
fi
|
|
|
|
if [[ ! -e ${SERVER} ]]; then
|
|
log "$SERVER does not exist, cannot launch server!"
|
|
exit 1
|
|
fi
|
|
|
|
export FAMILY=FABRIC
|
|
exec "${SCRIPTS:-/}start-setupWorld" "$@"
|