forked from itzg/docker-minecraft-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start-deployVanilla
43 lines (37 loc) · 1.33 KB
/
start-deployVanilla
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
. /start-utils
set -o pipefail
export SERVER="minecraft_server.${VANILLA_VERSION// /_}.jar"
if [ ! -e $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
log "Downloading $SERVER ..."
debug "Finding version manifest for $VANILLA_VERSION"
versionManifestUrl=$(curl -fsSL 'https://launchermeta.mojang.com/mc/game/version_manifest.json' | jq --arg VANILLA_VERSION "$VANILLA_VERSION" --raw-output '[.versions[]|select(.id == $VANILLA_VERSION)][0].url')
result=$?
if [ $result != 0 ]; then
log "ERROR failed to obtain version manifest URL ($result)"
exit 1
fi
if [ $versionManifestUrl = "null" ]; then
log "ERROR couldn't find a matching manifest entry for $VANILLA_VERSION"
exit 1
fi
debug "Found version manifest at $versionManifestUrl"
serverDownloadUrl=$(curl -fsSL ${versionManifestUrl} | jq --raw-output '.downloads.server.url')
result=$?
if [ $result != 0 ]; then
log "ERROR failed to obtain version manifest from $versionManifestUrl ($result)"
exit 1
fi
debug "Downloading server from $serverDownloadUrl"
if isDebugging; then
verbose=-v
fi
curl $verbose -fsSL -o $SERVER $serverDownloadUrl
result=$?
if [ $result != 0 ]; then
log "ERROR failed to download server from $serverDownloadUrl ($result)"
exit 1
fi
fi
# Continue to Final Setup
exec /start-finalSetup01World $@