-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-update_ver.1.0.sh
330 lines (318 loc) · 10.9 KB
/
install-update_ver.1.0.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
#!/bin/bash
#rev 1.0 ubuntu-server 18.04
clear
PING=github.com #адрес пингуемого сайта
uchoice=0 #переменя для ввода пользователем
un=$(whoami) #домашняя дирректория
ud=$(date) #текущая дата
userdate=$(date +%d.%m.%y) #текущая дата
function menu() {
clear
echo
# echo -e "\e[1;92m \tDate: $ud \e[0m"
# echo
echo -e "\e[1;92m \tWelcome '$un' to install and update the World of Warcraft server (version 1.0). \e[0m"
echo
echo -e "\e[1;94m \tChoice what you want to do: \e[0m"
echo
echo -e "\e[1;31m \t Install libs \e[0m"
echo -e " 1.Installing libraries for the server"
echo -e "\e[1;31m \t Download and install \e[0m"
echo " 2.Download and install WoW WotLK server (ver. 3.3.5a 12340)"
#echo -e " 3.Download and install WoW refreshable server (ver. master)"
echo -e "\e[1;31m \t Archive and update \e[0m"
echo " 3.Archive and update WoW WotLK server (ver. 3.3.5a 12340)"
# echo " 5.Archive and update WoW refreshable server server (ver. master)"
echo -e "\e[1;31m \t Extract and copy maps \e[0m"
echo " 4.Export maps for WoW WotLK client (ver. 3.3.5a 12340)"
# echo " 7.Export WoW refreshable maps"
echo -e "\e[1;31m \t Configuring configuration files \e[0m"
echo " 5.Configuring world server startup and authentication startup files"
echo -e "\e[1;31m \t Test internet connection \e[0m"
echo " 6.Ping Github"
echo -e "\e[1;31m \t Exit script \e[0m"
echo " 7.Exit"
echo -e "\e[1;31m \t In progress \e[0m"
# echo " 10.Download and install WoW BFA (ver.8.2.0.31478)"
echo -e "\e[1;95m \tWoW Legion (ver. 7.2.5): download,install,update,export maps,archive \e[0m"
echo -e "\e[1;95m \tWoW refreshable (ver. master): download,install,update,export maps,archive \e[0m"
echo
read -p "Enter your choice: " uchoice
echo
if [ "$uchoice" == "1" ]; then
inlib
elif [ "$uchoice" == "2" ]; then
installWotLK
elif [ "$uchoice" == "3" ]; then
updateWotLK
elif [ "$uchoice" == "4" ]; then
exportWotLK
elif [ "$uchoice" == "5" ]; then
ccf
elif [ "$uchoice" == "6" ]; then
checkinternet
elif [ "$uchoice" == "7" ]; then
exitscript
else
ers
fi
}
function inlib() {
if [ "$uchoice" == "1" ];
then
clear
echo
echo "The packages required for server / server operation will now be installed"
echo
sudo apt-get install dialog zenity geany geany-plugins git gitk gcp clang cmake make gcc g++ libmysqlclient-dev libssl-dev libbz2-dev libreadline-dev libncurses-dev libboost-all-dev mysql-server p7zip htop unrar engrampa pv subversion -y
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang 100
$SETCOLOR_SUCCESS
echo -n "$(tput hpa $(tput cols))$(tput cub 6)
[OK]"
sleep 2
echo
menu
fi
}
function installWotLK() {
if [ "$uchoice" == "2" ];
then
echo
echo -e "\e[1;92m \tWelcome to install Trinity Core for World of Warcraft Wrath of the Lich King "
echo
echo -e "\e[1;94m \t Now the server folder will be created in the HOME directory \e[0m"
mkdir ~/server
sleep 1
cd ~/server
echo
echo -e "\e[1;92m \tClone Trinity Core from GitHub \e[0m"
echo
git clone -b 3.3.5 git://github.com/TrinityCore/TrinityCore.git
echo
echo -e "\e[1;92m \tCreate build directory in Trinity Core \e[0m"
mkdir ~/server/TrinityCore/build
cd ~/server/TrinityCore/build
echo
echo -e "\e[1;95m \tCompilation Core server \e[0m"
echo
cmake ../ -DCMAKE_INSTALL_PREFIX=~/server
echo
read -p "Enter the number of cores to compile: " ucores
make -j $ucores
make install
echo
echo -e "\e[1;31m \tCreate folders with logs, data, updates and archive \e[0m"
echo
echo -e "\e[1;92m \tCreate 'data' path \e[0m"
mkdir ~/server/data
echo -e "\e[1;92m \tCreate 'log' path \e[0m"
mkdir ~/server/log
echo -e "\e[1;92m \tCreate 'updates' path \e[0m"
mkdir ~/server/updates
echo -e "\e[1;92m \tCreate 'archive' path \e[0m"
mkdir ~/server/archive
echo -e "\e[1;92m \tCreate 'clent' path\e[0m"
mkdir ~/server/client
echo
echo -e "\e[1;92m \tCompilation complete \e[0m"
echo -e "\e[1;92m \tInstall completed \e[0m"
echo
sleep 3
menu
fi
}
function updateWotLK() {
if [ "$uchoice" == "3" ];
then
clear
echo
echo -e "\e[1;92m \tWelcome to update Trinity Core for World of Warcraft Wrath of the Lich King \e[0m"
echo
echo -e "\e[1;94m \tArchiving the old TrinityCore from 'home/$un/server' to '/home/$un/server/archive' \e[0m"
echo
echo -e "\e[1;92m \tCreate TEMP directory in '/home/$un/server/archive' and copy the files 'bin,etc,log,TrinityCore' \e[0m"
echo
mkdir ~/server/archive/temp
sleep 2
cd ~/server
gcp -rf ~/server/{bin,etc,log} ~/server/archive/temp
gcp -rf ~/server/TrinityCore ~/server/archive/temp
echo
echo -e "\e[1;91m \tArchive the old TrinityCore in '/home/$un/server/archive' \e[0m"
echo
read -p "Select the archive name: " archivename
echo
cd ~/server/archive/temp
# tar -cvzf ../test.tar.gz .
tar -cf - . | pv -cN PACK_OLD_TRINITYCORE -s $(du -sb | grep -o '[0-9]*') | gzip > ../$archivename-$userdate.tar.gz.
echo
echo -e "\e[1;91m \tRemove TEMP dir in '/home/$un/server/archive \e[0m"
rm -rf ~/server/archive/temp
echo
echo -e "\e[1;92m \tArchiving done \e[0m"
echo
echo -e "\e[1;91m \tTrinityCore update started \e[0m"
echo
mkdir ~/server/updates/update_from_$userdate
sleep 1
cd ~/server/updates/update_from_$userdate
echo -e "\e[1;94m \tClone Trinity Core from GitHub \e[0m"
echo
git clone -b 3.3.5 git://github.com/TrinityCore/TrinityCore.git
echo
echo -e "\e[1;92m \tCreate build directory in Trinity Core \e[0m"
mkdir ~/server/updates/update_from_$userdate/TrinityCore/build
cd ~/server/updates/update_from_$userdate/TrinityCore/build
echo -e "\e[1;91m \tCompilation Core server \e[0m"
cmake ../ -DCMAKE_INSTALL_PREFIX=~/server
echo
read -p "Enter the number of cores to compile: " ucores
echo
make -j $ucores
make install
echo
echo -e "\e[1;92m \tCompilation complete \e[0m"
echo
sleep 1
echo -e "\e[1;91m \tCopy new updated server \e[0m"
echo
gcp -rf ~/server/updates/update_from_$userdate/TrinityCore ~/server
echo
echo -e "\e[1;92m \tCopy and update completed \e[0m"
sleep 3
menu
fi
}
function exportWotLK() {
if [ "$uchoice" == "4" ];
then
echo
echo -e "\e[1;92m \tWorld of Warcraft clinet (version 3.3.5a 12340) \e[0m"
echo
cd ~/server/client
echo -e "\e[1;91m \tExctract 'dbc,maps' \e[0m"
/home/$un/server/bin/mapextractor
echo -e "\e[1;91m \tExtract 'vmaps,mmaps' \e[0m"
~/server/bin/vmap4extractor
~/server/bin/vmap4assembler Buildings vmaps
~/server/bin/mmaps_generator
echo -e "\e[1;91m \tCopy 'dbc,maps,vmaps,mmaps' \e[0m"
gcp -rf ~/server/client/dbc ~/server/data
gcp -rf ~/server/client/maps ~/server/data
gcp -rf ~/server/client/vmaps ~/server/data
gcp -rf ~/server/client/mmaps ~/server/data
echo -e "\e[1;91m \tDelete all extract maps \e[0m"
rm -rf ~/server/client/dbc
rm -rf ~/server/client/maps
rm -rf ~/server/client/vmaps
rm -rf ~/server/client/mmaps
rm -rf ~/server/client/Buildings
echo
echo -e "\e[1;92m \tDone \e[0m"
sleep 2
menu
fi
}
function ccf() {
if [ "$uchoice" == "5" ];
then
read -p "Enter the name your '/home/' path: " unp
echo $unp > $un
echo
echo -e "\e[1;94m \tConfiguring and rename 'authserver.conf' and 'worldserver.conf' \e[0m"
cd ~/server/etc
cp authserver.conf.dist authserver.conf
cp worldserver.conf.dist worldserver.conf
#Конфигурирования сервера аутентификации
sed -i -e '42 s/ = ""/ = "\/home\/$un\/server\/log"/g' ~/server/etc/authserver.conf
sed -i -e '157 s/ = ""/ = "\/home\/$un\/server\/TrinityCore"/g' ~/server/etc/authserver.conf
sed -i -e '168 s/ = ""/ = "\/usr\/bin\/mysql"/g' ~/server/etc/authserver.conf
sed -i -e '246 s/= 0/= 1/g' ~/server/etc/authserver.conf
#Конфигурирование игрового сервера
sed -i -e '75 s/ = "."/ = "\/home\/$un\/server\/data"/g' ~/server/etc/worldserver.conf
sed -i -e '84 s/ = ""/ = "\/home\/$un\/server\/log"/g' ~/server/etc/worldserver.conf
sed -i -e '181 s/ = ""/ = "\/usr\/bin\/cmake"/g' ~/server/etc/worldserver.conf
sed -i -e '190 s/ = ""/ = "\/home\/$un\/server\/TrinityCore\/build"/g' ~/server/etc/worldserver.conf
sed -i -e '199 s/ = ""/ = "\/home\/$un\/server\/TrinityCore"/g' ~/server/etc/worldserver.conf
sed -i -e '210 s/ = ""/ = "\/usr\/bin\/mysql"/g' ~/server/etc/worldserver.conf
# echo "Configuring 'worldserver.conf' done"
sleep 1
sed -i -e '42 s/$un/'$unp'/g' ~/server/etc/authserver.conf
sed -i -e '157 s/$un/'$unp'/g' ~/server/etc/authserver.conf
sed -i -e '168 s/$un/'$unp'/g' ~/server/etc/authserver.conf
sed -i -e '246 s/$un/'$unp'/g' ~/server/etc/authserver.conf
#Замена переменныхв файлах worldserver и authserver
sed -i -e '75 s/$un/'$unp'/g' ~/server/etc/worldserver.conf
sed -i -e '84 s/$un/'$unp'/g' ~/server/etc/worldserver.conf
sed -i -e '181 s/$un/'$unp'/g' ~/server/etc/worldserver.conf
sed -i -e '190 s/$un/'$unp'/g' ~/server/etc/worldserver.conf
sed -i -e '199 s/$un/'$unp'/g' ~/server/etc/worldserver.conf
sed -i -e '210 s/$un/'$unp'/g' ~/server/etc/worldserver.conf
echo
cd
cd 'Рабочий стол'
rm -rf $unp
echo -e "\e[1;94m \tConfiguring and rename 'authserver.conf' and 'worldserver.conf' done \e[0m"
sleep 4
menu
fi
}
function checkinternet() {
if [ "$uchoice" == "6" ];
then
echo "Ping $PING"
echo
ping -c 3 $PING 1>/dev/null
res=$?
if [ "$res" == "0" ];
then
echo -e "\e[1;92m \t
[OK] \e[0m \e[1;94m \tConnection is good. The Network is UP \e[0m"
echo -e "\e[1;94m \tPress [Enter] to return to the menu... \e[0m"
read -n 1
else
echo -e "\e[1;91m \t
[Fail] \e[0m \e[1;94m \tBad connection. Something went wrong and Network is Down \e[0m"
echo -e "\e[1;94m \t Press [Enter] to return to the menu... \e[0m"
read -n 1
fi
echo
menu
fi
}
function exitscript() {
if [ "$uchoice" == "7" ];
then
clear
echo
echo -e "\e[1;32m \tThanks '$un' for using my script. Now the script will be exited \e[0m"
echo
echo -e "\e[1;32m \tSpecialist of the Department of information technology FSUE AGA(A) @Maksim Koldaev \e[0m"
echo
sleep 2
clear
exit 0
fi
}
function ers() {
if [ "$uchoice" != "" ];
then
echo -e "\e[1;91m \t
[Fail] \e[0m \e[1;94m \tAttention '$un' !!! Item menu in progress or item that's not in the menu. \e[0m"
echo -e "\e[1;94m \t Press [Enter] to return to the menu... \e[0m"
read -n 1
menu
elif [ "$uchoice" == "" ];
then
echo -e "\e[1;91m \t
[Fail] \e[0m \e[1;94m \tAttention '$un' !!! You choice an item that's not in the menu, or left the field empty,
or something went wrong. Press [Enter] to return to the menu and try again... \e[0m"
read -n 1
menu
fi
}
######################
# Entry point #
######################
menu