forked from itzg/docker-minecraft-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start-deployBukkitSpigot
88 lines (73 loc) · 2.28 KB
/
start-deployBukkitSpigot
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
set -e
function buildSpigotFromSource {
echo "Building Spigot $VANILLA_VERSION from source, might take a while, get some coffee"
rm -rf /data/temp
mkdir /data/temp
cd /data/temp
jvmOpts="-Xms${INIT_MEMORY:-$MEMORY} -Xmx${MAX_MEMORY:-$MEMORY}"
curl -sSL -o /data/temp/BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar && \
java $jvmOpts -jar /data/temp/BuildTools.jar --rev $VANILLA_VERSION 2>&1 |tee /data/spigot_build.log| while read l; do echo -n .; done; echo "done"
if ! mv spigot-*.jar /data/spigot_server.jar; then
echo "ERR failed to build Spigot"
cat /data/spigot_build.log
exit 1
fi
mv craftbukkit-*.jar /data/craftbukkit_server.jar
echo "Cleaning up"
rm -rf /data/temp
cd /data
}
function downloadSpigot {
local match
case "$TYPE" in
*BUKKIT|*bukkit)
match="CraftBukkit"
downloadUrl=${BUKKIT_DOWNLOAD_URL}
getbukkitFlavor=craftbukkit
;;
*)
match="Spigot"
downloadUrl=${SPIGOT_DOWNLOAD_URL}
getbukkitFlavor=spigot
;;
esac
local downloadVersion
if [[ ${VERSION} == LATEST ]]; then
downloadVersion=${VANILLA_VERSION}
else
downloadVersion=${VERSION}
fi
if [[ -z $downloadUrl ]]; then
downloadUrl="https://cdn.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${downloadVersion}.jar"
fi
echo "Downloading $match from $downloadUrl ..."
curl -fsSL -o $SERVER "$downloadUrl"
if [[ $? != 0 || $(grep -c "DOCTYPE html" $SERVER) != 0 ]]; 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
EOF
exit 3
fi
}
case "$TYPE" in
*BUKKIT|*bukkit)
export SERVER=craftbukkit_server.jar
;;
*)
export SERVER=spigot_server.jar
;;
esac
if [ ! -f $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
if [[ "$BUILD_SPIGOT_FROM_SOURCE" = TRUE || "$BUILD_SPIGOT_FROM_SOURCE" = true || "$BUILD_FROM_SOURCE" = TRUE || "$BUILD_FROM_SOURCE" = true ]]; then
buildSpigotFromSource
else
downloadSpigot
fi
fi
# Normalize on Spigot for operations below
export TYPE=SPIGOT
# Continue to Final Setup
exec /start-finalSetup01World $@