2018-07-31 02:49:43 +00:00
|
|
|
#!/bin/bash
|
2021-02-07 23:58:50 +00:00
|
|
|
set -euo pipefail
|
|
|
|
IFS=$'\n\t'
|
2018-07-31 02:49:43 +00:00
|
|
|
|
2021-10-10 17:05:37 +00:00
|
|
|
# shellcheck source=start-utils
|
2020-06-19 16:05:32 +00:00
|
|
|
. ${SCRIPTS:-/}start-utils
|
2020-03-06 15:52:17 +00:00
|
|
|
|
2021-10-10 17:05:37 +00:00
|
|
|
: "${EULA:=}"
|
|
|
|
: "${PROXY:=}"
|
|
|
|
: "${RCON_PASSWORD_FILE:=}"
|
2021-02-07 23:58:50 +00:00
|
|
|
|
2018-07-31 02:49:43 +00:00
|
|
|
shopt -s nullglob
|
|
|
|
|
2021-10-10 17:05:37 +00:00
|
|
|
isDebugging && set -x
|
|
|
|
|
2018-07-31 02:49:43 +00:00
|
|
|
#umask 002
|
|
|
|
export HOME=/data
|
|
|
|
|
2020-05-11 23:49:52 +00:00
|
|
|
log "Running as uid=$(id -u) gid=$(id -g) with /data as '$(ls -lnd /data)'"
|
|
|
|
|
2018-07-31 02:49:43 +00:00
|
|
|
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 ""
|
2018-07-31 02:49:43 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2019-09-15 22:15:33 +00:00
|
|
|
|
2020-07-26 18:19:45 +00:00
|
|
|
writeEula
|
2018-07-31 02:49:43 +00:00
|
|
|
fi
|
|
|
|
|
2019-09-15 22:15:33 +00:00
|
|
|
|
2018-07-31 02:49:43 +00:00
|
|
|
if [[ $PROXY ]]; then
|
|
|
|
export http_proxy="$PROXY"
|
|
|
|
export https_proxy="$PROXY"
|
2020-06-19 20:33:33 +00:00
|
|
|
export JAVA_TOOL_OPTIONS+="-Djava.net.useSystemProxies=true"
|
2020-03-06 15:52:17 +00:00
|
|
|
log "INFO: Giving proxy time to startup..."
|
2018-07-31 02:49:43 +00:00
|
|
|
sleep 5
|
|
|
|
fi
|
|
|
|
|
2020-07-14 02:00:46 +00:00
|
|
|
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
|
|
|
|
|
2021-03-06 22:05:01 +00:00
|
|
|
if ! which java > /dev/null; then
|
|
|
|
log "Fixing PATH to include java"
|
|
|
|
PATH="${PATH}:/opt/java/openjdk/bin"
|
|
|
|
fi
|
|
|
|
|
2018-07-31 02:49:43 +00:00
|
|
|
export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
|
|
|
|
|
|
|
|
case "X$VERSION" in
|
|
|
|
X|XLATEST|Xlatest)
|
2021-10-10 17:05:37 +00:00
|
|
|
VANILLA_VERSION=$(get "$VERSIONS_JSON" | jq -r '.latest.release')
|
2018-07-31 02:49:43 +00:00
|
|
|
;;
|
|
|
|
XSNAPSHOT|Xsnapshot)
|
2021-10-10 17:05:37 +00:00
|
|
|
VANILLA_VERSION=$(get "$VERSIONS_JSON" | jq -r '.latest.snapshot')
|
2018-07-31 02:49:43 +00:00
|
|
|
;;
|
|
|
|
*)
|
2020-07-19 17:22:15 +00:00
|
|
|
VANILLA_VERSION=$VERSION
|
2018-07-31 02:49:43 +00:00
|
|
|
;;
|
|
|
|
esac
|
2020-04-12 19:31:19 +00:00
|
|
|
export VANILLA_VERSION
|
2020-03-28 18:56:48 +00:00
|
|
|
log "Resolved version given ${VERSION} into ${VANILLA_VERSION}"
|
2018-07-31 02:49:43 +00:00
|
|
|
|
2020-04-12 19:31:19 +00:00
|
|
|
cd /data || exit 1
|
2018-07-31 02:49:43 +00:00
|
|
|
|
2018-08-12 22:25:16 +00:00
|
|
|
export ORIGINAL_TYPE=${TYPE^^}
|
2018-07-31 02:49:43 +00:00
|
|
|
|
2020-05-20 13:17:58 +00:00
|
|
|
if isTrue "${ENABLE_AUTOPAUSE}"; then
|
2020-06-19 16:05:32 +00:00
|
|
|
${SCRIPTS:-/}start-autopause
|
2020-05-20 13:17:58 +00:00
|
|
|
fi
|
|
|
|
|
2020-03-28 18:56:48 +00:00
|
|
|
log "Resolving type given ${TYPE}"
|
2018-08-12 22:25:16 +00:00
|
|
|
case "${TYPE^^}" in
|
|
|
|
*BUKKIT|SPIGOT)
|
2020-06-19 16:05:32 +00:00
|
|
|
exec ${SCRIPTS:-/}start-deployBukkitSpigot "$@"
|
2018-07-31 02:49:43 +00:00
|
|
|
;;
|
|
|
|
|
2018-08-12 22:25:16 +00:00
|
|
|
PAPER)
|
2020-06-19 16:05:32 +00:00
|
|
|
exec ${SCRIPTS:-/}start-deployPaper "$@"
|
2018-07-31 02:49:43 +00:00
|
|
|
;;
|
|
|
|
|
2018-08-12 22:25:16 +00:00
|
|
|
FORGE)
|
2021-07-25 14:50:40 +00:00
|
|
|
if versionLessThan 1.17; then
|
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"
|
2021-03-12 23:22:54 +00:00
|
|
|
log " Exception traces reporting ClassCastException: class jdk.internal.loader.ClassLoaders\$AppClassLoader"
|
|
|
|
log " can be fixed with java8"
|
2021-01-31 00:32:32 +00:00
|
|
|
log "**********************************************************************"
|
2021-07-25 14:50:40 +00:00
|
|
|
fi
|
2020-06-19 16:05:32 +00:00
|
|
|
exec ${SCRIPTS:-/}start-deployForge "$@"
|
2018-07-31 02:49:43 +00:00
|
|
|
;;
|
|
|
|
|
2019-07-10 03:19:59 +00:00
|
|
|
FABRIC)
|
2020-06-19 16:05:32 +00:00
|
|
|
exec ${SCRIPTS:-/}start-deployFabric "$@"
|
2019-07-10 03:19:59 +00:00
|
|
|
;;
|
|
|
|
|
2020-05-31 23:18:54 +00:00
|
|
|
FTBA)
|
2020-07-26 18:24:40 +00:00
|
|
|
exec ${SCRIPTS:-/}start-deployFTBA "$@"
|
2018-07-31 02:49:43 +00:00
|
|
|
;;
|
|
|
|
|
2018-08-12 22:25:16 +00:00
|
|
|
FTB|CURSEFORGE)
|
2021-02-09 03:15:28 +00:00
|
|
|
log "**********************************************************************"
|
|
|
|
log "WARNING: The image tag itzg/minecraft-server:java8 is recommended"
|
|
|
|
log " since some mods require Java 8"
|
2021-03-12 23:22:54 +00:00
|
|
|
log " Exception traces reporting ClassCastException: class jdk.internal.loader.ClassLoaders\$AppClassLoader"
|
|
|
|
log " can be fixed with java8"
|
2021-02-09 03:15:28 +00:00
|
|
|
log "**********************************************************************"
|
2020-06-19 20:01:28 +00:00
|
|
|
exec ${SCRIPTS:-/}start-deployCF "$@"
|
2020-05-31 23:18:54 +00:00
|
|
|
;;
|
|
|
|
|
2018-08-12 22:25:16 +00:00
|
|
|
VANILLA)
|
2021-10-10 17:05:37 +00:00
|
|
|
exec "${SCRIPTS:-/}start-deployVanilla" "$@"
|
2018-07-31 02:49:43 +00:00
|
|
|
;;
|
|
|
|
|
2018-08-12 22:25:16 +00:00
|
|
|
SPONGEVANILLA)
|
2020-06-19 16:05:32 +00:00
|
|
|
exec ${SCRIPTS:-/}start-deploySpongeVanilla "$@"
|
2018-07-31 02:49:43 +00:00
|
|
|
;;
|
|
|
|
|
2019-01-14 01:00:34 +00:00
|
|
|
CUSTOM)
|
2020-06-19 16:05:32 +00:00
|
|
|
exec ${SCRIPTS:-/}start-deployCustom "$@"
|
2020-04-12 19:31:19 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
CURSE_INSTANCE)
|
2020-06-19 16:05:32 +00:00
|
|
|
exec ${SCRIPTS:-/}start-validateCurseInstance "$@"
|
2019-01-14 01:00:34 +00:00
|
|
|
;;
|
|
|
|
|
2020-04-21 23:30:48 +00:00
|
|
|
MAGMA)
|
2020-06-19 20:33:33 +00:00
|
|
|
exec ${SCRIPTS:-/}start-deployMagma "$@"
|
2020-04-21 23:30:48 +00:00
|
|
|
;;
|
|
|
|
|
2020-06-19 16:31:56 +00:00
|
|
|
MOHIST)
|
2020-06-19 20:33:33 +00:00
|
|
|
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-04-21 23:30:48 +00:00
|
|
|
;;
|
|
|
|
|
2021-02-07 17:22:08 +00:00
|
|
|
PURPUR)
|
|
|
|
exec ${SCRIPTS:-/}start-deployPurpur "$@"
|
|
|
|
;;
|
|
|
|
|
2021-05-20 01:16:57 +00:00
|
|
|
AIRPLANE)
|
2021-04-08 23:50:06 +00:00
|
|
|
exec ${SCRIPTS:-/}start-deployAirplane "$@"
|
|
|
|
;;
|
2021-02-09 02:42:54 +00:00
|
|
|
|
2021-05-20 01:16:57 +00:00
|
|
|
CANYON)
|
|
|
|
exec ${SCRIPTS:-/}start-deployCanyon "$@"
|
|
|
|
;;
|
|
|
|
|
2021-08-15 17:44:31 +00:00
|
|
|
LIMBO)
|
|
|
|
exec ${SCRIPTS:-/}start-deployLimbo "$@"
|
|
|
|
;;
|
|
|
|
|
2018-07-31 02:49:43 +00:00
|
|
|
*)
|
2020-03-06 15:52:17 +00:00
|
|
|
log "Invalid type: '$TYPE'"
|
2020-07-18 18:09:58 +00:00
|
|
|
log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTBA (multiarch-only),"
|
2021-09-19 14:46:40 +00:00
|
|
|
log " CURSE_INSTANCE, CURSEFORGE, SPONGEVANILLA, PURPUR, CUSTOM,"
|
|
|
|
log " MAGMA, MOHIST, CATSERVER, AIRPLANE, CANYON, LIMBO"
|
2018-07-31 02:49:43 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|