Pre-compute the Bukkit/Spigot download URLs

For #77
This commit is contained in:
Geoff Bourne
2016-05-09 19:28:25 -05:00
parent b5e459ab0a
commit 5617936f10
3 changed files with 20 additions and 9 deletions
+5 -9
View File
@@ -50,22 +50,18 @@ function buildSpigotFromSource {
}
function downloadSpigot {
local match
case "$TYPE" in
*BUKKIT|*bukkit)
match="Craftbukkit $VANILLA_VERSION"
match="Craftbukkit"
;;
*)
match="Spigot $VANILLA_VERSION"
match="Spigot"
;;
esac
curl -o /tmp/versions -sSL https://getspigot.org/api/getversions
status=$?
if [ $status != 0 ]; then
echo "ERROR: failed to access Spigot versions (curl error code was $status)"
exit 3
fi
downloadUrl=$(cat /tmp/versions | jq -r ".[] | select(.version == \"$match\") | .downloadUrl")
downloadUrl=$(awk -F:: "\$1 == \"${match}\" && \$2 == \"${VANILLA_VERSION}\" {print \$3}" /tmp/mcadmin-versions.db)
if [[ -n $downloadUrl ]]; then
echo "Downloading $match"
wget -q -O $SERVER "$downloadUrl"