-
Notifications
You must be signed in to change notification settings - Fork 6
/
InstallWorld.sh
executable file
·59 lines (52 loc) · 1.29 KB
/
InstallWorld.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
#!/bin/sh
#sometimes updating the world DB doesn't suffice.
#Then it needs to be reinstalled.
#The world DB doesn't contain userdata.
#This means it is always safe to drop and recreate this database
svr="localhost"
user="root"
pass=$MYSQL_ROOT_PASSWORD
port="3306"
wdb="mangos0"
cdb="character0"
rdb="realmd"
DropWorld()
{
printf "Dropping World Database"
mysql -u $user -p$pass -q -s -e "Drop database ${wdb}"
}
CreateWorld()
{
printf "Creating World database ${wdb}\n"
mysql -u $user -p$pass -q -s -e "Create database ${wdb}"
}
LoadWorld()
{
printf "Loading data into world database ${wdb}\n"
mysql -u $user -p$pass -q -s ${wdb} < /database/World/Setup/mangosdLoadDB.sql
}
ImportWorld()
{
printf "Importing World database ${wdb}\n"
for file in $(ls /database/World/Setup/FullDB/*.sql | tr ' ' '|' | tr '\n' ' ')
do
file=$(echo ${file} | tr '|' ' ')
printf "Importing file ${file}\n"
mysql -u $user -p$pass -q -s ${wdb} < ${file}
printf "File ${file} imported\n"
done
}
UpdateWorld()
{
printf "Updating data into the World database ${wdb}\n"
for file in $(find /database/World/Updates/ -name '*.sql' -print)
do
printf "Applying update ${file}\n"
mysql -u $user -p$pass -s ${wdb} < ${file}
done
}
DropWorld
CreateWorld
LoadWorld
ImportWorld
for i in $(seq 1 25) ; do UpdateWorld ; done