forked from itzg/docker-minecraft-bedrock-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbedrock-entry.sh
executable file
·73 lines (60 loc) · 1.75 KB
/
bedrock-entry.sh
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
#!/bin/bash
downloadPage=https://www.minecraft.net/en-us/download/server/bedrock/
if [[ ${EULA^^} != TRUE ]]; then
echo
echo "EULA must be set to TRUE to indicate agreement with the Minecraft End User License"
echo "See https://minecraft.net/terms"
echo
echo "Current value is '${EULA}'"
echo
exit 1
fi
set -e
case ${VERSION} in
1.11)
VERSION=1.11.4.2
;;
1.12)
VERSION=1.12.0.28
;;
1.13|PREVIOUS)
VERSION=1.13.0.34
;;
1.14)
VERSION=1.14.60.5
;;
*)
for a in data-bi-prtid data-platform; do
DOWNLOAD_URL=$(restify --attribute=${a}=serverBedrockLinux ${downloadPage} 2> /tmp/restify.out | jq -r '.[0].href' || echo '')
if [[ ${DOWNLOAD_URL} ]]; then
break
fi
done
if [[ ${DOWNLOAD_URL} =~ http.*/.*-(.*)\.zip ]]; then
VERSION=${BASH_REMATCH[1]}
else
echo "Failed to extract download URL '${DOWNLOAD_URL}' from ${downloadPage}"
cat /tmp/restify.out
exit 2
fi
;;
esac
if [ ! -f "bedrock_server-${VERSION}" ]; then
if [[ ! ${DOWNLOAD_URL} ]]; then
DOWNLOAD_URL=https://minecraft.azureedge.net/bin-linux/bedrock-server-${VERSION}.zip
fi
TMP_ZIP=/tmp/$(basename "${DOWNLOAD_URL}")
echo "Downloading Bedrock server version ${VERSION} ..."
curl -o ${TMP_ZIP} -fsSL ${DOWNLOAD_URL}
# remove only binaries to allow for an upgrade of those
rm -f bedrock_server *.so 2> /dev/null
# ... use -n to avoid overwriting any existing files with the archive's copy
unzip -n -q ${TMP_ZIP}
rm ${TMP_ZIP}
chmod +x bedrock_server
mv bedrock_server bedrock_server-${VERSION}
fi
set-property --file server.properties --bulk /etc/bds-property-definitions.json
export LD_LIBRARY_PATH=.
echo "Starting Bedrock server..."
exec ./bedrock_server-${VERSION}