forked from fred-drake/TrinityCoreDocker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·78 lines (67 loc) · 1.93 KB
/
entrypoint.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
74
75
76
77
78
#!/bin/bash
if [ "$1" == "--worldserver" ]; then
echo "Initiating world server"
cd /server/bin && ./worldserver -c /config/worldserver.conf
exit 0
fi
if [ "$1" == "--bnetserver" ]; then
echo "Initiating bnet server"
cd /server/bin && ./bnetserver -c /config/bnetserver.conf
exit 0
fi
if [ "$1" == "--builddata" ]; then
echo "Building data from WoW client"
if [ ! -d "/wowclient" ]; then
echo "The WoW client must be mounted under /wowclient in order to extract data"
exit 1
fi
if [ ! -d "/data" ]; then
echo "A volume just be mounted under /data to store the data to be extracted from the WoW client"
exit 1
fi
cd /wowclient && \
/server/bin/mapextractor && \
cp -r dbc maps gt /data && \
/server/bin/vmap4extractor && \
mkdir vmaps && \
/server/bin/vmap4assembler Buildings vmaps && \
cp -r vmaps /data && \
mkdir mmaps && \
/server/bin/mmaps_generator && \
cp -r mmaps /data && \
cp -r cameras /data && \
rm -rf dbc cameras maps Buildings vmaps mmaps
exit 0
fi
if [ "$1" == "--dbinit" ]; then
echo "Initializing database"
if [ -z "$MYSQL_USER" ]; then
MYSQL_USER="trinity"
fi
if [ -z "$MYSQL_PASSWORD" ]; then
MYSQL_PASSWORD="trinity"
fi
if [ -z "$MYSQL_USER_HOST" ]; then
MYSQL_USER_HOST="%"
fi
if [ -z "$MYSQL_HOST" ]; then
MYSQL_HOST="host.docker.internal"
fi
if [ -z "$MYSQL_PORT" ]; then
MYSQL_PORT="3306"
fi
if [ -z "$MYSQL_ROOT_PASSWORD" ]; then
MYSQL_ROOT_PASSWORD="root"
fi
cp ~/TrinityCore/sql/create/create_mysql.sql /tmp
sed -i "s/'trinity'@'localhost'/'$MYSQL_USER'@'$MYSQL_USER_HOST'/g" /tmp/create_mysql.sql
sed -i "s/IDENTIFIED BY 'trinity'/IDENTIFIED BY '$MYSQL_PASSWORD'/g" /tmp/create_mysql.sql
mysql -h$MYSQL_HOST -uroot -P$MYSQL_PORT -p$MYSQL_ROOT_PASSWORD < /tmp/create_mysql.sql
rm -f /tmp/create_mysql.sql
exit 0
fi
if [ -z "$1" -o "${1:0:2}" = "--" ]; then
echo "You must have a parameter of --[worldserver|bnetserver|builddata|dbinit]"
exit 1
fi
exec "$@"