From 75f5647c93058b9f6f84a4cdf14ab9e8044ffedd Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 16 Mar 2024 14:01:21 -0500 Subject: [PATCH] Fallback to existing server file when getbukkit retrieval fails (#2721) --- examples/docker-compose.yml | 10 ++------ examples/spigot/docker-compose.yml | 13 +++++++++++ scripts/start-deployBukkitSpigot | 37 ++++++++++++++++++++---------- 3 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 examples/spigot/docker-compose.yml diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index 5d856cd1..a95e29a5 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -1,6 +1,3 @@ -version: '3' -# Other docker-compose examples in /examples - services: minecraft: image: itzg/minecraft-server @@ -9,10 +6,7 @@ services: ports: - "25565:25565" volumes: - - "mc:/data" + - ./data:/data environment: EULA: "TRUE" - restart: always - -volumes: - mc: {} \ No newline at end of file + restart: unless-stopped diff --git a/examples/spigot/docker-compose.yml b/examples/spigot/docker-compose.yml new file mode 100644 index 00000000..359e258b --- /dev/null +++ b/examples/spigot/docker-compose.yml @@ -0,0 +1,13 @@ +services: + mc: + image: itzg/minecraft-server + environment: + EULA: true + TYPE: SPIGOT + VERSION: 1.20.4 + ports: + - "25565:25565" + volumes: + - data:/data +volumes: + data: {} diff --git a/scripts/start-deployBukkitSpigot b/scripts/start-deployBukkitSpigot index aca66b4d..b1772e9b 100755 --- a/scripts/start-deployBukkitSpigot +++ b/scripts/start-deployBukkitSpigot @@ -76,35 +76,48 @@ function downloadSpigot { fi setServerVar + curlArgs=() if [ -f "$SERVER" ] && ! isTrue "$FORCE_REDOWNLOAD"; then # tell curl to only download when newer - curlArgs="-z $SERVER" + curlArgs+=(-z "$SERVER") fi if isDebugging; then - curlArgs="$curlArgs -v" + curlArgs+=(-v) fi log "Downloading $match from $downloadUrl ..." - curl -fsSL -o "$SERVER" $curlArgs "$downloadUrl" - if [[ $? != 0 || $(grep -c "DOCTYPE html" "$SERVER") != 0 ]]; then + + tempFile="$SERVER.$$" + + # HTTP error or download site responded with an HTML error page + if ! curl -fsSL -o "$tempFile" "${curlArgs[@]}" "$downloadUrl" || grep -iq "doctype html" "$tempFile"; then + cat <