Added FORCE_REDOWNLOAD support for Bukkit/Spigot (#1879)

This commit is contained in:
Geoff Bourne 2022-12-28 14:05:31 -06:00 committed by GitHub
parent 95da3c52bc
commit c9341ec125
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -421,6 +421,8 @@ Enable Bukkit/Spigot server mode by adding a `-e TYPE=BUKKIT` or `-e TYPE=SPIGOT
-e TYPE=SPIGOT \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
If the downloaded server jar is corrupted, set `FORCE_REDOWNLOAD` to "true" to force a re-download during next container startup. After successfully re-downloading, you should remove that or set to "false".
If you are hosting your own copy of Bukkit/Spigot you can override the download URLs with:
- -e BUKKIT_DOWNLOAD_URL=<url>

View File

@ -72,7 +72,7 @@ function downloadSpigot {
fi
setServerVar
if [ -f $SERVER ]; then
if [ -f "$SERVER" ] && ! isTrue "$FORCE_REDOWNLOAD"; then
# tell curl to only download when newer
curlArgs="-z $SERVER"
fi
@ -80,7 +80,7 @@ function downloadSpigot {
curlArgs="$curlArgs -v"
fi
log "Downloading $match from $downloadUrl ..."
curl -fsSL -o $SERVER $curlArgs "$downloadUrl"
curl -fsSL -o "$SERVER" $curlArgs "$downloadUrl"
if [[ $? != 0 || $(grep -c "DOCTYPE html" $SERVER) != 0 ]]; then
cat <<EOF
@ -92,12 +92,12 @@ ERROR: failed to download from $downloadUrl
EOF
if isDebugging && [[ $(grep -c "DOCTYPE html" $SERVER) != 0 ]]; then
cat $SERVER
if isDebugging && [[ $(grep -c "DOCTYPE html" "$SERVER") != 0 ]]; then
cat "$SERVER"
fi
# remove invalid download
rm $SERVER
rm "$SERVER"
exit 3
fi
@ -118,7 +118,7 @@ function setServerVar {
if isTrue "$BUILD_SPIGOT_FROM_SOURCE" || isTrue "$BUILD_FROM_SOURCE"; then
setServerVar
if [ ! -f $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
if [ ! -f "$SERVER" ] || isTrue "$FORCE_REDOWNLOAD"; then
buildSpigotFromSource
fi
else