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:
|
services:
|
||||||
minecraft:
|
minecraft:
|
||||||
image: itzg/minecraft-server
|
image: itzg/minecraft-server
|
||||||
@ -9,10 +6,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "25565:25565"
|
- "25565:25565"
|
||||||
volumes:
|
volumes:
|
||||||
- "mc:/data"
|
- ./data:/data
|
||||||
environment:
|
environment:
|
||||||
EULA: "TRUE"
|
EULA: "TRUE"
|
||||||
restart: always
|
restart: unless-stopped
|
||||||
|
|
||||||
volumes:
|
|
||||||
mc: {}
|
|
||||||
|
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
|
fi
|
||||||
|
|
||||||
setServerVar
|
setServerVar
|
||||||
|
curlArgs=()
|
||||||
if [ -f "$SERVER" ] && ! isTrue "$FORCE_REDOWNLOAD"; then
|
if [ -f "$SERVER" ] && ! isTrue "$FORCE_REDOWNLOAD"; then
|
||||||
# tell curl to only download when newer
|
# tell curl to only download when newer
|
||||||
curlArgs="-z $SERVER"
|
curlArgs+=(-z "$SERVER")
|
||||||
fi
|
fi
|
||||||
if isDebugging; then
|
if isDebugging; then
|
||||||
curlArgs="$curlArgs -v"
|
curlArgs+=(-v)
|
||||||
fi
|
fi
|
||||||
log "Downloading $match from $downloadUrl ..."
|
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
|
cat <<EOF
|
||||||
|
|
||||||
ERROR: failed to download from $downloadUrl
|
ERROR: failed to download from $downloadUrl
|
||||||
Visit https://getbukkit.org/download/${getbukkitFlavor} to lookup the
|
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.
|
exact version or see if download site is unavailable.
|
||||||
Click into the version entry to find the **exact** version, because something
|
Click into the version entry to find the **exact** version.
|
||||||
like "1.8" is not sufficient according to their download naming.
|
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
if isDebugging && [[ $(grep -c "DOCTYPE html" "$SERVER") != 0 ]]; then
|
if isDebugging && grep -iq "doctype html" "$tempFile"; then
|
||||||
cat "$SERVER"
|
cat "$tempFile"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# remove invalid download
|
if [ -f "$SERVER" ]; then
|
||||||
rm "$SERVER"
|
log "Continuing with existing $SERVER file"
|
||||||
exit 3
|
else
|
||||||
|
# remove invalid download
|
||||||
|
rm "$tempFile"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
mv "$tempFile" "$SERVER"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
JVM_OPTS="${JVM_OPTS} -DIReallyKnowWhatIAmDoingISwear"
|
JVM_OPTS="${JVM_OPTS} -DIReallyKnowWhatIAmDoingISwear"
|
||||||
export JVM_OPTS
|
export JVM_OPTS
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user