Improved handling of bad spigot/bukkit downloads via temp file

For #655
This commit is contained in:
Geoff Bourne 2020-11-02 20:31:01 -06:00
parent 31b8535854
commit e56a74dc81

View File

@ -72,8 +72,9 @@ function downloadSpigot {
zarg="-z $SERVER"
fi
log "Downloading $match from $downloadUrl ..."
curl -fsSL -o $SERVER $zarg "$downloadUrl"
if [[ $? != 0 || $(grep -c "DOCTYPE html" $SERVER) != 0 ]]; then
tmpJar=/tmp/${getbukkitFlavor}.jar
curl -fsSL -o "$tmpJar" $zarg "$downloadUrl"
if [[ $? != 0 || $(grep -c "DOCTYPE html" $tmpJar) != 0 ]]; then
cat <<EOF
ERROR: failed to download from $downloadUrl
@ -83,6 +84,7 @@ ERROR: failed to download from $downloadUrl
EOF
exit 3
fi
mv "$tmpJar" "$SERVER"
JVM_OPTS="${JVM_OPTS} -DIReallyKnowWhatIAmDoingISwear"
export JVM_OPTS