forked from BoxOfSnoo/docker-bedrockserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartup.sh
51 lines (39 loc) · 1.49 KB
/
startup.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
#!/bin/bash
# Update this as the file changes. Please be sure to agree to the EULA
BEDROCK_DOWNLOAD_ZIP=https://minecraft.azureedge.net/bin-linux/bedrock-server-1.9.0.15.zip
ZIPFILE=$(basename $BEDROCK_DOWNLOAD_ZIP)
cd /home/bedrock/bedrock_server
if [ ! -f $ZIPFILE ]; then
echo "Downloading file"
# Download and if successful, unzip (don't allow overwrites)
curl --fail -O $BEDROCK_DOWNLOAD_ZIP && unzip -n -q $ZIPFILE
# keep a copy of the server.properties file so we can restore defaults.
cp server.properties server.properties.defaults
fi
function copy_config() {
filename=$1
# if the file exists in the config folder then copy the config
if [ -f config/$filename ]; then
cp config/$filename $filename
# if there is a default config then copy that to both locations
elif [ -f $filename.defaults ]; then
cp $filename.defaults $filename
cp $filename.defaults config/$filename
fi
}
copy_config server.properties
copy_config ops.json
copy_config whitelist.json
copy_config permissions.json
# since (for Windows at least) we cannot currently mount the worlds
# directory directly, we need to copy the world data over at startup.
# copy recursively without overwriting existing files.
cp -r -n import/worlds/* worlds/
if [ -f "bedrock_server" ]; then
echo "Executing server"
LD_LIBRARY_PATH=. ./bedrock_server
else
echo "Server software not downloaded or unpacked!"
fi
# let's copy the resulting world data back out
cp -r -u worlds/* import/worlds/