2018-07-31 02:49:43 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-03-06 15:52:17 +00:00
|
|
|
. /start-utils
|
|
|
|
|
2018-07-31 02:49:43 +00:00
|
|
|
shopt -s nullglob
|
|
|
|
|
|
|
|
#umask 002
|
|
|
|
export HOME=/data
|
|
|
|
|
|
|
|
if [ ! -e /data/eula.txt ]; then
|
2019-10-01 18:54:14 +00:00
|
|
|
EULA="${EULA,,}"
|
|
|
|
if [ "$EULA" != "true" ]; 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
|
|
|
|
|
|
|
echo "# Generated via Docker on $(date)" > eula.txt
|
|
|
|
echo "eula=$EULA" >> eula.txt
|
|
|
|
if [ $? != 0 ]; then
|
2020-03-06 15:52:17 +00:00
|
|
|
log "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}"
|
2019-09-15 22:15:33 +00:00
|
|
|
exit 2
|
|
|
|
fi
|
2018-07-31 02:49:43 +00:00
|
|
|
fi
|
|
|
|
|
2019-09-15 22:15:33 +00:00
|
|
|
|
2020-03-06 15:52:17 +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 ! touch /data/.verify_access; then
|
2020-03-06 15:52:17 +00:00
|
|
|
log "ERROR: /data doesn't seem to be writable. Please make sure attached directory is writable by uid=$(id -u)"
|
2018-07-31 02:49:43 +00:00
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm /data/.verify_access || true
|
|
|
|
|
|
|
|
if [[ $PROXY ]]; then
|
|
|
|
export http_proxy="$PROXY"
|
|
|
|
export https_proxy="$PROXY"
|
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
|
|
|
|
|
|
|
|
export SERVER_PROPERTIES=/data/server.properties
|
|
|
|
export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
|
|
|
|
|
2020-03-06 15:52:17 +00:00
|
|
|
log "Checking version information."
|
2018-07-31 02:49:43 +00:00
|
|
|
case "X$VERSION" in
|
|
|
|
X|XLATEST|Xlatest)
|
|
|
|
export VANILLA_VERSION=`curl -fsSL $VERSIONS_JSON | jq -r '.latest.release'`
|
|
|
|
;;
|
|
|
|
XSNAPSHOT|Xsnapshot)
|
|
|
|
export VANILLA_VERSION=`curl -fsSL $VERSIONS_JSON | jq -r '.latest.snapshot'`
|
|
|
|
;;
|
|
|
|
X[1-9]*)
|
|
|
|
export VANILLA_VERSION=$VERSION
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
export VANILLA_VERSION=`curl -fsSL $VERSIONS_JSON | jq -r '.latest.release'`
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
cd /data
|
|
|
|
|
2018-08-12 22:25:16 +00:00
|
|
|
export ORIGINAL_TYPE=${TYPE^^}
|
2018-07-31 02:49:43 +00:00
|
|
|
|
2020-03-06 15:52:17 +00:00
|
|
|
log "Checking type information."
|
2018-08-12 22:25:16 +00:00
|
|
|
case "${TYPE^^}" in
|
|
|
|
*BUKKIT|SPIGOT)
|
2018-07-31 02:49:43 +00:00
|
|
|
exec /start-deployBukkitSpigot $@
|
|
|
|
;;
|
|
|
|
|
2018-08-12 22:25:16 +00:00
|
|
|
PAPER)
|
2018-07-31 02:49:43 +00:00
|
|
|
exec /start-deployPaper $@
|
|
|
|
;;
|
|
|
|
|
2018-08-12 22:25:16 +00:00
|
|
|
FORGE)
|
2018-07-31 02:49:43 +00:00
|
|
|
exec /start-deployForge $@
|
|
|
|
;;
|
|
|
|
|
2019-07-10 03:19:59 +00:00
|
|
|
FABRIC)
|
|
|
|
exec /start-deployFabric $@
|
|
|
|
;;
|
|
|
|
|
2018-08-12 22:25:16 +00:00
|
|
|
FTB|CURSEFORGE)
|
2018-07-31 02:49:43 +00:00
|
|
|
exec /start-deployFTB $@
|
|
|
|
;;
|
|
|
|
|
2018-08-12 22:25:16 +00:00
|
|
|
VANILLA)
|
2018-07-31 02:49:43 +00:00
|
|
|
exec /start-deployVanilla $@
|
|
|
|
;;
|
|
|
|
|
2018-08-12 22:25:16 +00:00
|
|
|
SPONGEVANILLA)
|
2018-07-31 02:49:43 +00:00
|
|
|
exec /start-deploySpongeVanilla $@
|
|
|
|
;;
|
|
|
|
|
2019-01-14 01:00:34 +00:00
|
|
|
CUSTOM)
|
|
|
|
exec /start-deployCustom $@
|
|
|
|
;;
|
|
|
|
|
2018-07-31 02:49:43 +00:00
|
|
|
*)
|
2020-03-06 15:52:17 +00:00
|
|
|
log "Invalid type: '$TYPE'"
|
|
|
|
log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTB, CURSEFORGE, SPONGEVANILLA"
|
2018-07-31 02:49:43 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|