mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
Fallback to existing server file when getbukkit retrieval fails (#2721)
This commit is contained in:
parent
d7512c44a9
commit
75f5647c93
@ -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: {}
|
||||
restart: unless-stopped
|
||||
|
13
examples/spigot/docker-compose.yml
Normal file
13
examples/spigot/docker-compose.yml
Normal file
@ -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: {}
|
@ -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 <<EOF
|
||||
|
||||
ERROR: failed to download from $downloadUrl
|
||||
Visit https://getbukkit.org/download/${getbukkitFlavor} to lookup the
|
||||
exact version, such as 1.4.6-R0.4-SNAPSHOT or 1.8-R0.1-SNAPSHOT-latest.
|
||||
Click into the version entry to find the **exact** version, because something
|
||||
like "1.8" is not sufficient according to their download naming.
|
||||
exact version or see if download site is unavailable.
|
||||
Click into the version entry to find the **exact** version.
|
||||
|
||||
EOF
|
||||
|
||||
if isDebugging && [[ $(grep -c "DOCTYPE html" "$SERVER") != 0 ]]; then
|
||||
cat "$SERVER"
|
||||
if isDebugging && grep -iq "doctype html" "$tempFile"; then
|
||||
cat "$tempFile"
|
||||
fi
|
||||
|
||||
if [ -f "$SERVER" ]; then
|
||||
log "Continuing with existing $SERVER file"
|
||||
else
|
||||
# remove invalid download
|
||||
rm "$SERVER"
|
||||
rm "$tempFile"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
else
|
||||
mv "$tempFile" "$SERVER"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
JVM_OPTS="${JVM_OPTS} -DIReallyKnowWhatIAmDoingISwear"
|
||||
export JVM_OPTS
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user