From b9f247728feb529603fc56df1a0c397b1845e067 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 24 Apr 2016 10:50:48 -0500 Subject: [PATCH] [mc] Detect and display curl error during Spigot/Bukkit download #74 --- minecraft-server/start-minecraft.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/minecraft-server/start-minecraft.sh b/minecraft-server/start-minecraft.sh index 3831b5ab..8c02fbd2 100755 --- a/minecraft-server/start-minecraft.sh +++ b/minecraft-server/start-minecraft.sh @@ -60,10 +60,20 @@ function downloadSpigot { 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") if [[ -n $downloadUrl ]]; then echo "Downloading $match" - curl -o $SERVER -sSL "$downloadUrl" + curl -o $SERVER -sSL "x$downloadUrl" + status=$? + if [ $status != 0 ]; then + echo "ERROR: failed to download from $downloadUrl due to (curl error code was $status)" + exit 3 + fi else echo "ERROR: Version $VANILLA_VERSION is not supported for $TYPE" echo " Refer to http://getspigot.org for supported versions"