docker-minecraft-server/minecraft-server/start-deployBukkitSpigot

79 lines
2.1 KiB
Plaintext
Raw Normal View History

2017-11-01 05:42:44 +00:00
#!/bin/bash
function buildSpigotFromSource {
echo "Building Spigot $VANILLA_VERSION from source, might take a while, get some coffee"
mkdir /data/temp
cd /data/temp
2018-06-26 00:13:47 +00:00
curl -sSL -o /data/temp/BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar && \
2017-11-01 05:42:44 +00:00
java -jar /data/temp/BuildTools.jar --rev $VANILLA_VERSION 2>&1 |tee /data/spigot_build.log| while read l; do echo -n .; done; echo "done"
mv spigot-*.jar /data/spigot_server.jar
mv craftbukkit-*.jar /data/craftbukkit_server.jar
echo "Cleaning up"
rm -rf /data/temp
cd /data
}
function downloadSpigot {
local match
case "$TYPE" in
*BUKKIT|*bukkit)
match="CraftBukkit"
2017-11-01 05:42:44 +00:00
downloadUrl=${BUKKIT_DOWNLOAD_URL}
getbukkitFlavor=craftbukkit
2017-11-01 05:42:44 +00:00
;;
*)
match="Spigot"
downloadUrl=${SPIGOT_DOWNLOAD_URL}
getbukkitFlavor=spigot
2017-11-01 05:42:44 +00:00
;;
esac
local downloadVersion
if [[ ${VERSION} == LATEST ]]; then
downloadVersion=${VANILLA_VERSION}
else
downloadVersion=${VERSION}
fi
2017-11-01 05:42:44 +00:00
if [[ -z $downloadUrl ]]; then
downloadUrl="https://cdn.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${downloadVersion}.jar"
2017-11-01 05:42:44 +00:00
fi
echo "Downloading $match from $downloadUrl ..."
curl -fsSL -o $SERVER "$downloadUrl"
if [[ $? != 0 || $(grep -c "DOCTYPE html" $SERVER) != 0 ]]; 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 or 1.8-R0.1-SNAPSHOT-LATEST
EOF
2017-11-01 05:42:44 +00:00
exit 3
fi
}
case "$TYPE" in
*BUKKIT|*bukkit)
export SERVER=craftbukkit_server.jar
;;
*)
export SERVER=spigot_server.jar
;;
esac
if [ ! -f $SERVER ]; then
if [[ "$BUILD_SPIGOT_FROM_SOURCE" = TRUE || "$BUILD_SPIGOT_FROM_SOURCE" = true || "$BUILD_FROM_SOURCE" = TRUE || "$BUILD_FROM_SOURCE" = true ]]; then
buildSpigotFromSource
else
downloadSpigot
fi
fi
# Normalize on Spigot for operations below
export TYPE=SPIGOT
# Continue to Final Setup
exec /start-finalSetup01World $@