docker-minecraft-server/start-configuration

147 lines
3.2 KiB
Text
Raw Normal View History

#!/bin/bash
. ${SCRIPTS:-/}start-utils
2020-03-06 15:52:17 +00:00
shopt -s nullglob
#umask 002
export HOME=/data
log "Running as uid=$(id -u) gid=$(id -g) with /data as '$(ls -lnd /data)'"
if [ ! -e /data/eula.txt ]; then
2020-07-26 18:19:45 +00:00
if ! isTrue "$EULA"; then
2020-03-06 15:52:17 +00:00
log ""
log "Please accept the Minecraft EULA at"
log " https://account.mojang.com/documents/minecraft_eula"
log "by adding the following immediately after 'docker run':"
log " -e EULA=TRUE"
log ""
exit 1
fi
2020-07-26 18:19:45 +00:00
writeEula
fi
if [[ $PROXY ]]; then
export http_proxy="$PROXY"
export https_proxy="$PROXY"
export JAVA_TOOL_OPTIONS+="-Djava.net.useSystemProxies=true"
2020-03-06 15:52:17 +00:00
log "INFO: Giving proxy time to startup..."
sleep 5
fi
if [[ $RCON_PASSWORD_FILE ]]; then
log ""
if [ ! -e ${RCON_PASSWORD_FILE} ]; then
log "Initial RCON password file ${RCON_PASSWORD_FILE} does not seems to exist."
log "Please ensure your configuration."
log "If you are using Docker Secrets feature, please check this for further information: "
log " https://docs.docker.com/engine/swarm/secrets"
log ""
exit 1
else
RCON_PASSWORD=$(cat ${RCON_PASSWORD_FILE})
export RCON_PASSWORD
fi
log ""
fi
export SERVER_PROPERTIES=/data/server.properties
export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
case "X$VERSION" in
X|XLATEST|Xlatest)
2020-04-12 19:31:19 +00:00
VANILLA_VERSION=$(curl -fsSL $VERSIONS_JSON | jq -r '.latest.release')
;;
XSNAPSHOT|Xsnapshot)
2020-04-12 19:31:19 +00:00
VANILLA_VERSION=$(curl -fsSL $VERSIONS_JSON | jq -r '.latest.snapshot')
;;
*)
VANILLA_VERSION=$VERSION
;;
esac
2020-04-12 19:31:19 +00:00
export VANILLA_VERSION
log "Resolved version given ${VERSION} into ${VANILLA_VERSION}"
2020-04-12 19:31:19 +00:00
cd /data || exit 1
export ORIGINAL_TYPE=${TYPE^^}
2020-05-20 13:17:58 +00:00
if isTrue "${ENABLE_AUTOPAUSE}"; then
${SCRIPTS:-/}start-autopause
2020-05-20 13:17:58 +00:00
fi
log "Resolving type given ${TYPE}"
case "${TYPE^^}" in
*BUKKIT|SPIGOT)
exec ${SCRIPTS:-/}start-deployBukkitSpigot "$@"
;;
PAPER)
exec ${SCRIPTS:-/}start-deployPaper "$@"
;;
2020-04-25 00:13:51 +00:00
TUINITY)
exec ${SCRIPTS:-/}start-deployTuinity "$@"
2020-04-24 23:56:15 +00:00
;;
FORGE)
2021-01-31 00:32:32 +00:00
log "**********************************************************************"
log "WARNING: The image tag itzg/minecraft-server:java8 is recommended"
log " since some mods require Java 8"
log "**********************************************************************"
exec ${SCRIPTS:-/}start-deployForge "$@"
;;
2019-07-10 03:19:59 +00:00
FABRIC)
exec ${SCRIPTS:-/}start-deployFabric "$@"
2019-07-10 03:19:59 +00:00
;;
FTBA)
exec ${SCRIPTS:-/}start-deployFTBA "$@"
;;
CURSEFORGE|FTB)
exec ${SCRIPTS:-/}start-deployCF "$@"
;;
VANILLA)
exec ${SCRIPTS:-/}start-deployVanilla "$@"
;;
SPONGEVANILLA)
exec ${SCRIPTS:-/}start-deploySpongeVanilla "$@"
;;
CUSTOM)
exec ${SCRIPTS:-/}start-deployCustom "$@"
2020-04-12 19:31:19 +00:00
;;
CURSE_INSTANCE)
exec ${SCRIPTS:-/}start-validateCurseInstance "$@"
;;
MAGMA)
exec ${SCRIPTS:-/}start-deployMagma "$@"
;;
2020-06-19 16:31:56 +00:00
MOHIST)
exec ${SCRIPTS:-/}start-deployMohist "$@"
2020-06-19 16:31:56 +00:00
;;
2020-06-20 20:28:21 +00:00
CATSERVER)
exec ${SCRIPTS:-/}start-deployCatserver "$@"
;;
*)
2020-03-06 15:52:17 +00:00
log "Invalid type: '$TYPE'"
log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTBA (multiarch-only),"
log " CURSE_INSTANCE, CURSEFORGE, SPONGEVANILLA,"
log " CUSTOM, MAGMA, MOHIST, CATSERVER"
exit 1
;;
esac