mc: Download Bukkit and Spigot from getbukkit.org

This commit is contained in:
Geoff Bourne 2018-03-16 17:03:21 -05:00
parent c288557188
commit 2627317e03
2 changed files with 14 additions and 14 deletions

View file

@ -31,7 +31,6 @@ EXPOSE 25565 25575
ADD https://github.com/itzg/restify/releases/download/1.0.4/restify_linux_amd64 /usr/local/bin/restify
ADD https://github.com/itzg/rcon-cli/releases/download/1.3/rcon-cli_linux_amd64 /usr/local/bin/rcon-cli
COPY start* /
COPY mcadmin.jq /usr/share
RUN chmod +x /usr/local/bin/*
@ -47,3 +46,5 @@ ENV UID=1000 GID=1000 \
TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= LEVEL=world \
PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= SERVER_PORT=25565 ONLINE_MODE=TRUE CONSOLE=true
COPY start* /

View file

@ -19,31 +19,30 @@ function downloadSpigot {
*BUKKIT|*bukkit)
match="Craftbukkit"
downloadUrl=${BUKKIT_DOWNLOAD_URL}
getbukkitFlavor=craftbukkit
;;
*)
match="Spigot"
downloadUrl=${SPIGOT_DOWNLOAD_URL}
getbukkitFlavor=spigot
;;
esac
if [[ -z $downloadUrl ]]; then
downloadUrl=$(restify --class=jar-div https://mcadmin.net/ | \
jq --arg version "$match $VANILLA_VERSION" -r -f /usr/share/mcadmin.jq)
if [[ -z $downloadUrl ]]; then
echo "ERROR: Version $VANILLA_VERSION is not supported for $TYPE"
echo " Refer to https://mcadmin.net/ for supported versions"
exit 2
fi
downloadUrl="https://cdn.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${VERSION}.jar"
fi
echo "Downloading $match"
curl -kfsSL -o $SERVER "$downloadUrl"
status=$?
if [ ! -f $SERVER ]; then
echo "ERROR: failed to download from $downloadUrl (status=$status)"
echo "Downloading $match ..."
if ! curl -fsSL -o $SERVER "$downloadUrl"; then
cat <<EOF
ERROR: failed to download from $downloadUrl
Visit https://getbukkit.org/download/${getbukkitFlavor} to lookup the
exact version, such as 1.4.6-R0.4-SNAPSHOT
EOF
exit 3
fi
}