|
|
楼主 |
发表于 2022-7-29 17:20:43
|
显示全部楼层
- wget -c https://raw.githubusercontent.com/mangostwo/server/master/linux/getmangos.sh && bash getmangos.sh
复制代码- #!/bin/bash( d" C; u' x" S: z4 s* z
- ###############################################################################6 Y) x q4 i# l& |
- # MaNGOS Build Automation Script #
$ d) T: ]+ Z3 k1 }" \6 o% i2 r. V - # Written By: Ryan Ashley #- z; a4 i* C+ ?7 R$ }" U2 T% i
- # Updated By: Cedric Servais #
# K1 o* E9 B5 m9 v - # Copyright (C) 2014-2022 MaNGOS https://getmangos.eu/ #
5 X {, \, `& W" O! i. F0 y% ~/ s - # #
% D$ u4 F9 o0 S8 O- U! p$ F - # This program is free software; you can redistribute it and/or modify #
4 L# a0 r! S$ `2 \) H! N - # it under the terms of the GNU General Public License as published by #) T/ T7 o9 j; w5 G8 {# {0 I
- # the Free Software Foundation; either version 2 of the License, or #" [% S) k: w8 p v/ j) c
- # (at your option) any later version. #: c" | g* q) s7 d
- # ## H9 @) C! x# Q
- # This program is distributed in the hope that it will be useful, #1 {0 k8 i" S: n* ?/ ]" |1 K: V
- # but WITHOUT ANY WARRANTY; without even the implied warranty of #
" t# C, Y6 X/ G& t& K2 O& ~ - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
0 p1 M8 @* O( W- X" \! S - # GNU General Public License for more details. #
8 f; J2 s, v: G- h - # #
0 _+ i8 ]) W" Y, a - # You should have received a copy of the GNU General Public License #
; Q1 G5 R5 s3 J. e6 T& X - # along with this program; if not, write to the Free Software #
& E5 `3 c' I* e, H7 {; W - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #8 _- y; l) Z, ^( k! m4 ]
- ###############################################################################
" f+ h- O0 x: ~) j4 O2 M7 m
+ G: n1 m" s6 d9 c7 U( N' o- # Global variables8 U) W% s: X. I" D
- DLGAPP="whiptail"
$ }& Y1 w: t7 |4 v0 ~4 Z - VERSION="2" w; Z! g( ^) h! p2 k$ w2 ]
- ROOTPATH="$HOME"
* N8 q8 k3 `& W+ ], X/ n - SRCPATH="$HOME/mangos/src"
' |/ {) N: E; Y N% h* r* _1 U+ H - INSTPATH="$HOME/mangos": T2 ?% {% O! \' c' I; O" T- V7 B
- DB_PREFIX="two"$ D o: n# H& D; t! X) ^
- USER="mangos"
7 ?: E# `$ h, O1 N7 C - P_SOAP="0"& o1 U1 H# s) K: ?" g5 j( k
- P_DEBUG="0"
. {3 n: a1 r3 M- }9 p6 k2 U - P_STD_MALLOC="1"; j3 D7 c) T, i3 ]. i
- P_ACE_EXTERNAL="1"
* U6 ~: N# I7 q3 I6 y& _+ | - P_PGRESQL="0" s* G+ J% r1 v$ C* y1 d
- P_TOOLS="0"$ l4 e( D+ o- j
- P_SD3="1"" x( ^/ I0 T- Z6 J4 b; M4 D6 b
- P_ELUNA="1"
D7 r9 P# h8 c9 e) v - P_BOTS="0"
) F2 C* S. U: @: ~ - CMAKE_CMD="cmake", h/ M1 L H$ f) a0 |
( N& r- ]) u! _; W- " _8 o) a+ c1 Q
- function UseCmake3()# N& Q4 j: W9 B R
- {
4 y- P1 M1 }0 a0 k: V1 c; }. p" K - # set the command to cmake3 if its there! {+ w# `# i t
- which cmake33 d: w! r: v1 Q9 Y" L3 w
- if [ $? -eq 0 ]; then
1 k9 L4 ?) C) }/ x3 D( ?: d9 h1 N. h - CMAKE_CMD="cmake3"- r( A4 W0 o4 F
- fi0 N, P: l( v% \
- }. ^7 U. _1 Q5 j- H' Z* U, Z2 P
) U; t# G" W; k: N- # Function to test for dialog0 Y& I+ a' n* _7 t' x
- function UseDialog() E: {& ` i! D% g/ P
- {
) g, n6 B/ H1 E6 A# ]! u, F) [3 O6 r - # Search for dialog2 `- w5 f ]; @( R# q
- which dialog- B$ ^; {* o6 A2 C
- 5 R# ?4 M1 T0 ?
- # See if dialog was found
" R4 Y$ q( r7 h* { - if [ $? -eq 0 ]; then
/ j/ O& w, f1 u [: y - DLGAPP="dialog"
: D& u1 r/ w: Y' } - fi
0 M7 r) ~6 o# b6 Y. r - }% i" v0 _2 c+ i+ {! ]( q
" ^5 t D0 A b; W& |9 K O: ]- # Function to test if the user is root or not5 T8 f# C# S- W6 k
- function CheckRoot()
& {7 b4 T. n6 y2 J4 m - {, V3 a e' @# |4 y% ~7 B4 ]" R
- if [ "$(id -u)" != "0" ]; then
5 `& [, j9 |% x8 U% l$ X - Log "This script can only be used as root!" 1$ m; I; K0 K& w3 Q
- exit 1% m! U* f2 j8 E0 @9 s R
- else
( |* j7 t, o$ | o - Log "User is root, check passed" 0
7 k3 a# f1 i' p& \" D; N% f; ` - fi
# l* c0 {. W" ^# r+ `1 Q - }
7 Q* Z3 b/ k% i b* X! k+ B
& @. S5 g @, ?4 [- # Function to detect the repos
0 i/ S, g: L; G" A9 z - function DetectLocalRepo()5 G- I5 I) C" K: r, U
- {
h( s# x K; z2 a/ x: S0 M - local CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
* A) a3 | T! t+ E - # _8 x' m' z$ |3 f/ R$ Z& V
- # First see if the Windows stuff is in place
' F/ ?" p5 @: Z3 s5 @( |1 Q6 T4 ~2 q - if [ ! -d ../win ]; then3 V8 ~' G/ w6 f4 u4 u( P4 M. {' _
- Log "Windows files directory does not exist, assuming repo has not been cloned." 0$ o: `0 \; Q; t' |% q
- return 0
+ W) Q% I' M% p - fi
1 n4 ]3 {6 h# G: _# \$ B% `" ~, E
3 d! M7 N$ \0 K3 [: y- # See if the sources dircetory exists) V! g$ d( l S, ^# k& H. w# a* I
- if [ ! -d ../src ]; then. M8 ]9 ?/ ?) B1 `- Q
- Log "Source files directory does not exist, assuming repo has not been cloned." 09 S/ h" R( h' L0 f1 e; K! W
- return 0
6 @$ D3 S1 r) L0 t& Z - fi, S7 k+ B8 x4 r& W2 f! _% x A9 d
- / ]! P, T9 M0 G) I, G7 c, T
- # Check for the CMake directory
2 z, V$ p- a+ D N: b: ?, z$ L - if [ ! -d ../cmake ]; then
- L2 T& i9 s1 s* O! N* e2 o5 @ - Log "CMake directory does not exist, assuming repo has not been cloned." 0' X4 N) x* D' {" y, @! u. s
- return 0
, N4 Q+ u$ R9 g. y( w3 `/ V! C - fi- S+ I4 f) f3 H
- # C# g2 W0 z$ I( }- l5 C
- # Set the default paths based on the current location8 t7 t" ]* d" d2 v
- SRCPATH=$( dirname $CUR_DIR )
6 g7 k: m, I: v - SRCPATH=$( dirname $SRCPATH )
$ o* _4 a- E: m2 o: {7 n
# K/ k3 X( E( z4 C* {- # Log the detected path
% I0 k/ l* ^# E" c- g) i( f0 o - Log "Detected cloned repository in $SRCPATH" 0
1 W4 J9 \. G6 f, y2 D5 [ - }
! \2 F# S% P6 @4 Y* a4 O9 ]/ S - 4 k9 c) m# Y6 G/ Z. |( ]' {
- \ t/ o: Z6 U/ I) m
- $ o& q4 [1 q3 R5 J) ]' U
- # Function to log results
; E& L% F# B* D+ o& ^ - function Log()- S# m+ Z# H1 M# S2 q! d
- {& G0 }( V9 C1 x) m
- local TIMESTAMP=$( date +%Y-%m-%d:%H:%M:%S )# u1 \. f: x3 K+ _. k$ C b
- 5 L( q; q. X" g
- # Check the number of parameters: R3 m0 z; v5 y; s
- if [ $# -ne 2 ]; then
3 M6 h' F4 g+ D! b( g& b) D6 m) \& A - echo "Logging usage: Log <message> <echo flag>"0 K3 |5 w; i, c1 z+ X$ u3 N
- return 1
, W, v6 x# z. V5 `. H$ h3 C - fi
3 G9 |* B- F+ j- [0 K2 l* E - 2 B- ?+ M! }1 ^5 P* J/ D: [9 w5 n
- # Echo to the console if requested
$ B+ H' n+ R. n8 ` - if [ $2 -eq 1 ]; then3 `+ K$ }: z' P% d; z4 j
- echo "$1"
, J! r' r' ^! E+ a - fi& V$ S4 J( k7 d9 E: f
- * i! F8 I9 h: L+ f$ C# h/ x0 H
- # Append the string to the log
v3 X! M( \6 x3 P& g - echo "$TIMESTAMP $1" >> ~/getmangos.log6 x8 L* S2 y* s4 Y
- }
8 g& {" G0 i" ]+ ?' g - 8 ? N( u" F/ X
- 1 L" ?4 ^) s3 t0 N
- / t5 p3 o7 N/ S- W
- # Function to install prerequisite libraries
5 m9 s2 ~! n# P8 Z( v& C R* | - function GetPrerequisites()5 a- @! }9 T* o9 c$ |) }
- {
! d+ A( Z& c7 B3 h9 ]0 {$ I - # First, we need to check the installer.
& O* B9 @# l/ N! ~ - installer=06 a- B$ |) J+ d( k" `4 b
- 9 ]9 @0 v1 Y3 D+ |6 C0 H7 q
- which apt-get& p9 m7 f7 L; B* b5 X
3 k) f0 O0 j" {% {/ Y9 |- if [ $? -ne 0 ]; then# c8 p% F# _$ i* R! T
- Log "apt-get isn't the installer by default" 1. L3 X& ~5 m! K" f% p# W
- else5 j2 S h' W# L& a4 ^; V" L
- installer=11 P6 T* [! K2 r
- # On a fresh OS boot (EC2) libace was not found without first updating + c# o% q8 L- Q0 @9 w
- apt-get update -y && apt-get -y install git lsb-release curl$ S! K8 b* L3 f/ ?2 n+ m/ j* _6 n" x" J
- fi
) s- m8 f& z& k0 R+ ~
5 a5 w7 w- p/ O: m- which yum
: C3 J" J2 }0 @
# e* w6 |! ^( q& Q+ c2 W1 \2 P- if [ $? -ne 0 ]; then
/ r8 D. V7 e& R5 M - Log "yum isn't the installer by default" 1
' Y( k3 A# N/ r - else# k& b! ]3 h$ ?" m5 y/ Z1 l
- installer=1
. K( ?; \; L! K% r* U5 } - yum -y install git redhat-lsb curl# Z; w3 {. n& N$ d6 _
- fi6 a. i- g0 C" A: i$ ?0 b" e
- ' P' h6 v, F+ f8 I/ B) ]& Q9 p* T
- which aptitude0 O" Q: u3 U& d0 }) Y
- if [ $? -ne 0 ]; then
8 x- }( o1 _& q* h - Log "aptitude isn't the installer by default" 1
; M9 J9 o$ V! }$ _( I, d! I - else) y0 J5 K7 _3 y# f, D R. o+ Q+ p
- installer=1
$ a1 T* N! e- b9 I; A1 I - aptitude -y install git lsb-release curl
, l- m7 o- N( l+ m - fi
5 U& H9 z; U) y$ G8 Q8 m8 `% e - . y# ]7 K/ v; V' ~. \$ ~; A
- # Then, let's check that we have the necessary tools to define the OS version.- o6 }5 n; g2 \3 s) J9 [2 r
- which lsb_release
- j3 A% q' A- `) j* y5 `- A1 {
% {; a8 M: w* `1 J- if [ $? -ne 0 ]; then5 z0 t4 J6 | x! c: [, \
- Log "Cannot define your OS distribution and version." 1
- a+ D6 [3 z( T% c, m$ J% ?/ @ - return 05 ]1 J9 v) ]4 J
- fi
6 I) X- U2 W1 u; W% Y - 9 Q( O2 c! A4 y) m+ M9 ?
- local OS=$(lsb_release -si)+ d( I9 ]/ P2 }& q+ H' ~
- local VER=$(lsb_release -sc)
4 U6 o9 ^9 r- G1 b2 p0 `# k3 V6 _ - local OS_VER=1
% r3 N ?! E3 k: ]3 G3 U1 v. q6 F - " @4 I8 I( z1 ~* r1 E1 k" h0 n, S
- # Ask the user to continue
/ ]: S; i R' r; E2 [ - $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Install Required Dependencies" \# k9 N7 m( Z* K F- P
- --yesno "Would you like to install the required build and development packages?" 8 60
1 K/ ]! J: k0 A0 ]6 @
- D: C7 x3 \; C1 h2 b, d0 U( U- # Check the user's response5 D- M7 h- j. `; z8 r1 r
- if [ $? -ne 0 ]; then
2 U1 }/ E* j! v. x - Log "User declined to install required tools and development libraries." 1
5 \( z3 b# c. j0 E: y - return 0& E7 x: t' S& [; c1 F1 z& d
- fi; z9 f! D$ V" M/ p& g9 M
- 6 _0 m+ l7 H; U& N. U
- # Inform the user of the need for root access" K( r7 x3 K% D& T8 Q
- $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Install Required Dependencies" \
8 h) L9 o! T& y0 r4 i' A. u y' i. r - --yesno "Installing packages requires root access, which you will be prompted for.\nDo you want to proceed?" 8 60
5 Q9 L; V8 Y& N4 d - * V8 q% V( D$ y/ Q
- # Check the user's response
- ]0 e0 l+ u" k( W5 \ - if [ $? -ne 0 ]; then
' P* c$ _5 H' `7 N E - Log "User declined to proved root access for package installation." 1( A9 Z$ i$ n% u5 [5 R
- return 0$ }% M$ n+ W Q$ r4 E8 Q s
- fi
% h4 Z3 U3 o+ l3 `0 K - ( m( F0 i( a3 s: K+ \; l3 w
- # Handle OS
3 b% I% T4 M7 N( i. V - case ${OS} in5 {7 R! B8 c0 ?" {
- "LinuxMint")
( @! l/ t0 r2 @0 b1 w - case ${VER} in
: {2 {. f. Z1 c1 U1 V - "sarah")
2 U9 z4 U1 F) E - # Linux Mint 18 - Ubuntu Xenial based2 J' z6 F* G, O7 Y" A: P
- su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root
- Q% O; j; h6 x, c9 s2 Q" u4 x* E - ;;
# G* w7 W: P2 N# D% t+ _4 { - "rosa")
& R6 q4 X+ E1 G; Z3 z& n - # Linux Mint 17.3 - Ubuntu Trusty based
2 V3 [& }4 b/ a2 M) O! p - su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root0 ]% C* \1 [% d8 B9 [
- ;;
5 Y: ^- D5 O% c. f - "rafaela")
& t+ N3 I2 c0 X# T - # Linux Mint 17.2 - Ubuntu Trusty based
' u: b4 R* {$ R9 l6 ^ - su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root
* I6 u; J. P' E# e. ?: H e - ;;
4 j7 ?9 h* w, ~) z% g - "rebecca")
# h9 p: Q* r6 Z3 x# e9 E/ v - # Linux Mint 17.1 - Ubuntu Trusty based
9 b. B8 K0 ?8 u - su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root1 n) d" W3 V3 A* m: O) `
- ;;- |7 |$ T4 H( k" n! T0 \
- "qiana")
9 N2 ]& }+ i$ ^2 r - # Linux Mint 17 - Ubuntu Trusty based
3 z8 o0 u' G$ _ - su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root* N; h1 d0 u# `) y$ W
- ;;/ t9 l# `" x. H
- "maya") ]; i6 @* }7 d1 ?6 d
- # Linux Mint 13 - Ubuntu Precise based
# e1 C4 J6 I3 T' D7 q2 S1 E3 ] - su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root
: K9 @) N( t( p4 d3 k% k8 X - ;;
* L9 l7 k x+ |, m7 x8 N - "betsy")
0 ]: n( @2 M9 d/ A$ y Q) z. Y - # LMDE 2 - Debian Jessie based! y0 s7 H4 Y( w2 P
- su -c "aptitude -y install build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.2.8 libssl-dev libmysqlclient-dev libtool zliblg-dev" root
$ ]3 r: q$ Y8 J+ j - ;;, C: A) I) ]" u$ _7 I6 r
- *)) u) M; m& v$ b1 Z
- OS_VER=00 \$ O4 A, R3 M4 F8 s
- ;;0 w7 ~2 B6 t% e5 n" S3 c1 `
- esac/ v& ~ m5 P% E- F/ v$ O
- ;;3 k: e6 L' Y9 u, V2 `. V
- "Ubuntu")/ n* ?/ y. X5 {' T7 d6 [3 O
- case ${VER} in
9 ~' n+ F& K# X w- O( x; I+ W! d. p% Q - "precise")
1 t( j/ g \: h- j4 J, ~ - # Ubuntu 12.04 LTS( p: I/ B& @8 A7 w* M$ r5 S
- su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root2 c1 K, [7 B5 C6 ]0 C
- ;;
5 J5 l% j9 }4 P$ Z8 f - "trusty")6 W# @6 p/ \! v' N1 h
- # Ubuntu 14.04 LTS' D( o0 g' P$ V6 Z! O1 Q% T9 E* O
- su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root4 r* _% x. z0 m3 V2 B
- ;;
5 z4 D/ C! ?3 F2 z& I- T$ l0 C4 G - "xenial"): [/ n; O& m( T7 x
- # Ubuntu 16.04 LTS! C: }' f) h( J
- su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root; q0 L3 B% T7 d4 x' ^8 b+ x6 ^
- ;;, V; F# F. |7 S4 Q# @7 W# x" |
- "yakkety")
% U4 V! g4 J0 M - # Ubuntu 16.10
- o; d, R C5 ~1 P - su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
# p2 N J. c7 c; \- K8 v - ;;8 C, H; p) W# ~% l
- "zesty")% K" d* `9 x: F4 L8 z" k D5 r v* u* J
- # Ubuntu 17.04' M/ ]4 C3 i" }. n* ]
- su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
. x+ Y$ w, S- c% w* B6 {2 m5 g - ;;2 c! C+ k- o1 H# Y4 j
- "artful")
1 G& {6 V- h4 p0 K# w J* S5 N0 i d - # Ubuntu 17.10) l3 K- L, S8 F) [/ _
- su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root1 y) n5 c& N n2 s* O6 `/ B
- ;;: ? F7 C. }- {0 Q) _7 t" ]
- "bionic")
+ H5 i3 c$ ~+ J2 m/ G - # Ubuntu 18.04 LTS
L7 T' |. v' k! S3 N- U8 \) H - su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
, \6 [9 H, a# c3 }& T - ;;1 }: ], w, u0 V
- "disco")1 S6 O+ X) h& v0 Y8 z7 K" J
- # Ubuntu 19.04
8 q4 J) y& F% U* X% v: l - su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root/ G" Z% [+ n; h' e- U
- ;;2 |9 N9 |! n6 z$ a/ N
- "focal")
" g( L0 B7 M e H4 w - # Ubuntu 20.04
& u( t( n! M# }5 F2 X! w2 P - su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root+ [; j8 e9 K5 w; Y) S' c
- ;;( s- i/ X/ O5 p9 {
- *)
, a" {+ `: X) a$ h) J - OS_VER=01 V$ U: D+ d% r! K2 t) M% V9 S
- ;;5 g/ M q1 U$ y& p
- esac8 f, w, C9 K5 l6 J7 H
- ;;
+ U( q$ }! |1 s5 Q2 H; N0 R - "Debian") E$ R7 c8 ~5 h0 q# w
- case ${VER} in
; J3 N$ Y3 T; k } - "jessie")1 q7 T& ]+ m% B% E$ j Q4 _, W: J
- # Debian 8.0 "current"# P& W! r; S) m3 L6 Z: u
- su -c "aptitude -y install curl build-essential autoconf automake cmake libbz2-dev libace-dev libssl-dev default-libmysqlclient-dev libtool" root
; M8 e+ T2 K0 G7 d - ;;
) a ]2 F$ S# @ - "stretch")4 J6 a+ ?0 e/ f& I0 _+ ?
- # Debian Next
|+ J, o+ @ }0 G - su -c "aptitude -y install curl build-essential autoconf automake cmake libbz2-dev libace-dev libssl-dev default-libmysqlclient-dev libtool" root
x4 D q7 Q# D7 K' _( f. ] - ;;+ W- S5 o4 `: p% W! L+ }
- *)+ w2 v; A6 X/ u& B
- OS_VER=0+ w0 `, z, z5 y3 \3 F, H; y
- ;;
4 [7 T5 S0 v1 D5 J" Z - esac: K& a+ s: b! T& H9 @. c% N. c
- ;;5 Q* O/ d. e) x* W1 Q
- "RedHatEntrepriseServer")/ F4 G6 h& G1 Y6 ~) L
- case ${VER} in0 r) \3 @. r4 W3 l' R1 @1 u
- "santiago")
5 q4 y; G2 I2 ^( P! @ - # Red Hat 6.x
; A$ [3 ?8 ]' ^7 J0 L4 { - su -c "yum -y install curl build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev ace-6.3.3 libssl-dev libmysqlclient-dev libtool zliblg-dev" root: a. \) Y& m! |& I( E$ v* j
- ;;
N7 H4 r, @8 |" d( z - "maipo")9 i, |8 {$ u# B S" l
- # Red Hat 7.x
9 j; U2 X5 u' y- K/ Q3 Q9 V - su -c "yum -y install curl build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev ace-6.3.3 libssl-dev libmysqlclient-dev libtool zliblg-dev" root4 {$ p% F: k/ O! Y. Q% O* c d5 m! a& ?
- ;;
9 d: n# v5 V! w: H) ^, D/ r0 \9 Q. a - *)# L$ Y$ l8 O/ j$ u
- OS_VER=0
# @5 o+ \/ m) r! Z8 y; M9 y - ;;! A/ f/ S: n; s. h1 ~0 X8 ^
- esac- g6 D3 p7 Z5 R2 Q4 j# Y c o0 `
- ;;) ^9 |* i- _5 e# G8 w I
- "CentOS")
# J8 i" e& T! f# I - case ${VER} in
5 Q) N& [, ]- a% W. E1 k: R ]' r - "Core")
6 ]3 N$ x F1 |% n" `; J - # Default CentOS - Adding necessary RPM third-party.
. M/ Z! L2 { G - rpm -Uv ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/devel:/libraries:/ACE:/micro/CentOS_7/x86_64/ace-6.3.3-55.1.x86_64.rpm; v1 ?2 Y0 q4 l5 K6 w
- rpm -Uv ftp://rpmfind.net/linux/centos/7/os/x86_64/Packages/perl-Net-Telnet-3.03-19.el7.noarch.rpm4 W- t/ R x; U, m
- rpm -Uv ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/devel:/libraries:/ACE:/micro:/versioned/CentOS_7/x86_64/mpc-6.3.3-42.1.x86_64.rpm
c% q# s; y7 h o$ M: o9 B - rpm -Uv ftp://rpmfind.net/linux/centos/7/os/x86_64/Packages/libtool-2.4.2-22.el7_3.x86_64.rpm4 L- C3 I4 [, u, ]2 k) C6 M
- rpm -Uv ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/devel:/libraries:/ACE:/micro/CentOS_7/x86_64/ace-devel-6.3.3-55.1.x86_64.rpm
% D9 J. z& u/ H( L' h - su -c "yum -y install epel-release"
% a$ L4 T. z3 @ - su -c "yum -y install curl autoconf automake cmake3 ace-devel ace-6.3.3 openssl-devel mysql-devel libtool gcc-c++ bzip2-devel" root
3 b8 d; g! a, V% [9 X* W - ;;0 D7 u! i" S+ I9 M2 [) N
- *)
. e1 p# x9 c0 l4 s+ [1 a - OS_VER=0
: \- Z! ~- ~3 m; @) H6 ]) P0 r5 C3 f - ;;( I' z7 P8 A# V' ]
- esac
" L3 J: B+ V0 q+ H' d - ;;
& m2 n, ^5 \5 }1 ~8 M- N0 ~( c - "Fedora")
7 M7 y+ `5 C/ O& h1 i/ d1 n - case ${VER} in1 @( ^# N% l: Q# }- X* O
- "TwentyFive")
. R" r9 b, S% z: R - # Fedora 25 - Adding necessary RPM third-party.
0 }2 S, O: y V% v, D - su -c "yum -y install autoconf automake libtool gcc-c++" root
2 G0 h7 m4 l, D! M* q9 R4 a - # Getting and building ACE. Not provided in RPM for Fedora...
+ i7 @/ p2 Y1 ~2 U+ Y0 a - rm -rf ACE-6.3.3.tar.bz2* k: r5 S& L3 w: w; X7 J; \
- rm -rf ACE_wrappers
4 E3 e- y/ a9 G) W3 A: @ - wget ftp://download.dre.vanderbilt.edu/previous_versions/ACE-6.3.3.tar.bz2$ V7 b% c; Q9 o+ P
- tar xjvf ACE-6.3.3.tar.bz2
7 p t. Q- |1 c, j' V: G+ e; J - export ACE_ROOT=/root/ACE_wrappers: Q* z* Z8 g, t
- echo '#include "ace/config-linux.h"' >> $ACE_ROOT/ace/config.h: M) ]+ e6 z! z+ G
- echo 'include $(ACE_ROOT)/include/makeinclude/platform_linux.GNU' >> $ACE_ROOT/include/makeinclude/platform_macros.GNU M9 i5 Z" K# k1 O9 f% }6 F7 _
- echo 'INSTALL_PREFIX=/usr/local' >> $ACE_ROOT/include/makeinclude/platform_macros.GNU2 u( B- ]9 U- G. k" [5 O9 Z7 u
- export LD_LIBRARY_PATH=$ACE_ROOT/lib:$LD_LIBRARY_PATH
3 u5 L* }, x- v9 I& F T& E2 l - CD $ACE_ROOT6 M/ a7 n8 S% `1 O2 }% t! T
- make
5 F* K0 d5 k/ w5 d' Y - make install* _+ x" _( o+ P# [" S
- cd ~
; H) J0 Y- e1 F: x8 X% y - # Installing remaining dependencies..
, `/ ]( p+ y; F! @3 p - su -c "yum -y install cmake openssl-devel mariadb-devel" root
" [- U6 K1 \! l* k; F9 i - ;;% A% m5 ]% s% _. M
- *)
& n& p5 C( D5 I$ R; h2 S: y0 G! d - OS_VER=09 @: C3 [/ ~3 w, b0 y) f$ M
- ;;
. M1 ]% l6 T! M/ Z8 l4 r% N( R - esac/ [1 o+ o+ G" ~* J' S
- ;;5 P! B9 q* t% J% D
- *)
' F) t( `* F& q - OS_VER=0* `- O1 L2 y1 b7 D X
- ;;- C) E% \: y2 Z" _! M
- esac4 U! a/ O0 V f. y4 p1 A
5 `1 m% s0 c& O6 i. y- # See if a supported OS was detected8 b% [2 R( E+ c! @6 g
- if [ ${OS_VER} -ne 0 ]; then2 r9 _& O4 F7 i$ |% v4 z* [: e. b* v
- # Log success! M; u( ~# V, Q, B& ?2 \+ ~
- Log "The development tools and libraries have been installed!" 1
. n l5 }$ h7 _+ m" o( o) T0 j - else
' l9 u/ s# F# I* ?2 N& C - # Note the error
2 l; \* x8 }, c! y- w5 H- h - Log "Could not identify the current OS. Nothing was installed." 1
1 n6 k" x1 t* D5 U - fi
: I' Q! O- k4 s5 W, R1 d6 t - }/ @; o, {: s! w: o4 J
' q" \* u1 w* q$ U. G
. u4 z+ k3 J6 Y7 `1 G- ] p- . p' T1 h3 a: M7 k" z
- # Function to get the WoW version
' R. ?/ h+ H# d2 T4 e5 o' T1 y4 H - function GetRelease()9 T0 h, D- p$ j0 J6 n
- {; \$ a0 e; g: H" F3 h
- VERSION=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Choose WoW Release" \( K7 k! c2 H( D
- --menu "Select a version of WoW" 0 0 5 \
5 B9 b& I5 T! _: X1 v5 ] - 0 "Original Release (Vanilla)" \* j% c2 y7 S5 v0 f+ C
- 1 "The Burning Crusade" \+ Z- V- p, u. B7 F N
- 2 "Wrath of The Lich King" \9 B0 H; r, T6 L0 A' D
- 3 "Cataclysm" \
. ~/ O( i' M- x9 n( e( @4 w - 4 "Mists of Pandaria" \
! @* _* M2 H. j( F - 5 "Warlords of Draenor" \5 q6 s* P" H9 M, r
- 3>&2 2>&1 1>&3)4 [! @4 w8 z- X% C& z
- 0 c; ?0 x: F! ^! ?" f- ^' t
- # Exit if cancelled2 d% Q; N+ Q4 S" o
- if [ $? -ne 0 ]; then6 R# T: S8 H3 @2 g
- Log "Version selection cancelled by user. No changes have been made to your system." 1. T# D( Z' ]+ G4 Y7 ]% P
- exit 0 w; z1 v3 M/ } Z7 H8 @
- fi
, ~! a& [, r5 ?4 M4 w
( R: d2 K8 F' U o- # Set some defaults based on the release
6 i8 H$ P# n' v4 [: y - case "$VERSION" in
6 ?8 j! O. ?2 N# Z - 0)
9 S& Y$ K; U# n7 `% o - SRCPATH="$ROOTPATH/zero/src"6 ]$ c0 W* E. C; y( }% J$ M) R7 o m
- INSTPATH="$ROOTPATH/zero"
+ t% _1 L+ c! N& Z" }8 U - DB_PREFIX="zero"
! n) w: {" o9 f0 \) e2 s _8 I! l) Z - ;;
1 J0 i9 s: B6 K - 0 D" P' ^6 n. C# |
- 1); |. U! F5 s/ [+ g* `
- SRCPATH="$ROOTPATH/one/src"
8 `- m! e' l) D4 q3 P Y - INSTPATH="$ROOTPATH/one"
; d& L& k9 u- t& O& K0 f - DB_PREFIX="one"0 K" R+ x, | I. I7 }6 n
- ;;- U& X* w1 [+ z5 s
+ k5 {$ L+ g! E# [( z0 D- 2)$ }/ A3 V* a) R
- SRCPATH="$ROOTPATH/two/src"; R. z4 k4 L. k' _/ C( @6 Q
- INSTPATH="$ROOTPATH/two"% \$ P2 y4 {! N# P
- DB_PREFIX="two"! z. Z3 w7 ` p/ q
- ;;
5 k# y9 w F J; ^5 _$ Y - ! j. j' k- p, z7 O
- 3)1 u5 s+ M6 w: O# \. m, ?: e) C7 r
- SRCPATH="$ROOTPATH/three/src"
: Z5 `( ^5 _& A5 ^7 @6 i1 b - INSTPATH="$ROOTPATH/three"
! E; c& L- M3 Z x - DB_PREFIX="three"5 z7 w3 Q7 d+ |6 O4 U, p4 Z# `/ K
- ;;
i# t& @" a( j5 a# w: d$ A6 d
4 V3 n. L/ ?4 z q- 4)0 k1 ~, B3 |# O2 i
- SRCPATH="$ROOTPATH/four/src"
" G5 a. d( B6 @ - INSTPATH="$ROOTPATH/four"4 K5 f: h3 {5 u# x; [
- DB_PREFIX="four"
9 I1 [" f- n8 O. F7 h. j - ;;
4 R- L! _6 y! ?) X' Q - 5)0 C. v% K1 q1 I
- SRCPATH="$ROOTPATH/five/src"
, P4 h* m8 B8 z2 q - INSTPATH="$ROOTPATH/five"
" K% P8 _. `9 U& A7 u4 L9 y @ - DB_PREFIX="five"& M8 v) Q: l7 T2 r1 e" N: p
- ;;
& j }7 r8 u b9 ~( |" Q( v i - *)& O* ^- e! b" W+ T. `; n- O
- Log "Error: Unknown version selected!" 1
/ B/ z- `2 }7 I* F+ A$ L9 H* \ - exit 1
0 E# f" ?8 v, Y# Q8 ^, g% z7 L1 R - ;;
3 {, \" R0 s! y+ J3 N) T0 T* b* |. H - esac
# t; n5 ` ?# M- F8 V: h; o
# |. ?( V* \ q8 R# V. @( a6 D- # Now set the correct source path if the repo has been cloned already3 q" [/ t1 G" k$ P9 N. k
- DetectLocalRepo- Q: W3 }: |# i) h
- }8 f' q0 K/ s/ ]. N, o" x3 x
- 9 k" c( Q" ~8 T0 N/ Q; T
- # Function to setup the technical user
3 P+ \# e8 m1 V. h$ C - function GetUser()* j3 P1 k, D q0 j
- {. |8 R# V$ I% W. g* R
- local TMPUSER="$USER"2 ^6 U+ `* Z D6 S# ^9 i, }
; x7 f7 T! N. Q. e, F$ B/ a- # Set the user
/ s1 K" {8 |0 z; F - TMPUSER=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "User to run Mangos" \
6 o& s3 v& B' |! I6 W/ S4 i- M - --inputbox "Default: $USER" 8 60 3>&2 2>&1 1>&3)$ K3 E" }7 D7 ]$ c
- ! i+ Z" b. ?3 Y; W, ?% I a
- # Exit if cancelled7 p! r) R: P4 Y! e6 {
- if [ $? -ne 0 ]; then
, M- Z9 I& r E! u - Log "User selection was cancelled. No changes have been made to your system." 1
4 }( z+ I$ } ^8 m - exit 0
' s- n6 R% R3 H4 R, Y P9 S: m - fi
( w$ [* S: ?2 { j - ' N& g/ z3 Z9 v$ r1 _: b- n. z
- # Change the user only if it was modified: ~2 x8 C4 s0 T6 x- V
- if [ ! -z "$TMPUSER" ]; then
" U+ v7 [ O q, K6 W! z - USER="$TMPUSER"
# b7 v1 e- j0 ]1 _ T' ^ - fi
9 Z$ w' r9 z$ a/ A" M- G - $ N# q% H6 m, Y+ ~0 i# A
- # Validate user7 i$ ?8 A, A( R4 L- T% ]
- id $USER > /dev/null 2>&1/ `! _* u& V; [
- if [ $? -ne 0 ]; then
* ~7 R! p9 x5 ?2 U/ c1 g( x. H- { - Log "Creating user: $USER" 1
& J/ w! D' W, z8 O& f8 e Z - useradd -m -d /home/$USER $USER > /dev/null 2>&1
4 W4 X/ U$ T M
/ N; }8 ^# Y2 n. T- if [ $? -ne 0 ]; then
' z4 f7 t% ^' h* J - Log "Error: Failed to create the specified user!" 1
& [6 p% X! s5 F) h A. g7 F - exit 1+ B5 s' \5 R& n% Z
- fi) h% L: j5 k9 |1 r
- 1 r+ w# }8 e! K+ N# h5 c
- usermod -L $USER > /dev/null 2>&15 j# t9 [$ T/ k% C" O ~# b
- else, }- v1 @9 h9 L w- R
- # User already exist, asking to keep the user2 A( U6 f: Y6 b0 `) i7 f* d8 a4 A
- $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "User already exist" \- o4 ?! w' i: g4 }6 F) A2 P7 r
- --yesno "Would you like to keep the user "$USER"?" 8 60
|4 i+ \) ]" s. o
& b7 t& V9 j* A" ^. O- if [ $? -ne 0 ]; then, k* y6 o( S6 {
- Log "Removing user: $USER" 1( O& A4 d+ i d4 B: B0 J u
- userdel -r $USER > /dev/null 2>&1
+ e5 I' y! i2 j4 N7 {9 |4 Z
: f2 h" Z* i! R+ r- Log "Creating user: $USER" 15 v3 Z- O! E" L1 y$ ^
- useradd -m -d /home/$USER $USER > /dev/null 2>&1
$ p* }; D4 C% _! ~& P: K. ~2 c
8 P6 q% r/ r+ S$ `- if [ $? -ne 0 ]; then7 O. R5 G2 f/ u7 l' O- B
- Log "Error: Failed to create the specified user!" 1
+ `: A, S/ ^/ C) k - exit 1: E8 ^$ n4 R$ ~6 _
- fi
" A. P- R, ?/ S4 ^2 L8 a9 a' T0 \ - 4 Z9 f, P6 U3 x' r. A b( F
- usermod -L $USER > /dev/null 2>&1
7 |' \4 j0 T+ X8 ^& w# Q - fi
+ ]4 ]& u/ N B; @2 F- b% q. L - fi
* o8 M! {" J# s; V
" p& `$ r2 y) h8 r9 q- ROOTPATH="/home/"$USER1 c& E; `/ ^+ S L0 X. |
- Log "User: $USER" 0; \3 Y7 \# f; A
- }, `% _) n% a3 s
- J. R8 x1 t/ C$ W# T
- # Function to get the source and installation paths: V2 [1 s* q) L+ j
- function GetPaths()
G4 M# o9 ^2 _# u. N" W* K8 [ - {
9 j c, l2 M3 o( V - local TMPPATH="$HOME"
0 Z2 U. x( X; m2 O5 h
' l X% ~& t1 N& Y- # Set the source path4 q) y6 V) g" L [7 G
- TMPPATH=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Source-Code Path" \ z* u) Y" q# {* v2 Q/ E8 [
- --inputbox "Default: $SRCPATH" 8 60 3>&2 2>&1 1>&3)
' L/ s: _5 X: k# x$ R6 X& F
6 B+ S. D6 G7 O2 r: E; D; m- # Exit if cancelled* i5 A/ F% y7 x7 k
- if [ $? -ne 0 ]; then- i) H. ?6 @7 F' w0 }) d# o
- Log "Source path selection was cancelled. No changes have been made to your system." 11 S$ P6 V+ A& M/ e" R( U* ?
- exit 06 P0 F/ W9 t; Z2 R0 m8 ^4 V8 S8 M
- fi0 u3 I5 i$ r/ u! E, r6 v% ^
Z/ T0 F; n+ B' w# l) Y* Q- # Change the path only if it was modified
) W2 {7 j4 z* I% Z& T" o! C - if [ ! -z "$TMPPATH" ]; then, U. a1 V( f% B+ }! Z
- SRCPATH="$TMPPATH"
6 X! W6 s9 l% }6 Z2 U - fi( x6 ^2 {0 f1 M
7 l% d3 Y I" A- # Validate source path
* p1 y" b& q* _2 ~ - if [ ! -d "$SRCPATH" ]; then
( u% X, e; ~5 } - $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Path does not exist" \
- E; Y/ y V" V! F- ^ - --yesno "Would you like to create the directory "$SRCPATH"?" 8 60
1 E! m' L; @. \
7 j# F, `9 L7 }; ^( _- if [ $? -eq 0 ]; then F/ ?' z' r0 h: e2 T2 a; J% H- K
- Log "Creating source path: $SRCPATH" 18 _1 U* e! y+ p; y
- mkdir -p "$SRCPATH" > /dev/null 2>&1
& k) D& k, S; v1 v$ t - ) p/ E% U- N/ K3 O
- # Check to see if the directory was created
4 w$ ]4 o f& o - if [ $? -ne 0 ]; then+ K* i; q7 |2 K1 g/ w( Z4 l& v
- Log "Error: Failed to create the specified source-code directory!" 1
1 r: |$ a8 j: K5 p - exit 19 u( a2 U* j7 m3 I
- fi
2 [' T/ l Q# l+ K. @ - else
1 X7 t a& W5 @ - Log "Source path creation cancelled. No modifications have been made to your system." 1
& H/ b0 k; V$ b' {+ j - exit 01 U6 D& B6 a* B" E" `: l1 c0 J
- fi
: b3 ^: ^- y7 |! R2 x - else/ R; I) V0 B" l* u9 b# h+ x
- # Check for old sources: w& P+ [9 Z4 N% Q" }8 Z
- if [ -d "$SRCPATH/server" ] || [ -d "$SRCPATH/database" ]; then; x& C) p. r+ ?* J
- # Ask to remove the old sources& P/ m" K+ S0 c l' a6 I: J
- $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Path already exists" \
7 X8 B% ^( t2 ` b. \ - --yesno "Would you like to remove the old sources? (Answer yes if you are cloning MaNGOS)" 9 60
. z# A% W3 J2 `) U4 j$ h
, s; p' G- B$ s8 D/ x6 L- # Remove the old sources if requested) x2 g! K' |! W$ g9 ?$ s
- if [ $? -eq 0 ]; then. X' I$ o# l+ e) ?& G9 L3 \# ?# h
- Log "Removing old sources from: $SRCPATH/*" 1; T& @5 B* O( {. `# d
- rm -rf $SRCPATH/*$ a. E: S; g$ q" v j
- 5 ?9 a) p9 x& o2 I) s; P
- # Check for removal failure- R. j& Y: }+ k( J8 o5 ^0 V* h
- if [ $? -ne 0 ]; then
' W* P. R* I, ^& b - Log "Error: Failed to remove old sources!" 1
* v& R' A) {: k k' H2 E9 G0 d1 Y - exit 1
+ D- R% H5 e3 C# F - fi7 V, l0 E- W: R: u q& U
- fi: \. F8 O# p7 R
- fi
. E% V5 I, s% h- X6 A' Y - fi
' v4 `( \' `5 O8 W% U - - ?7 {5 T& K3 a5 m* l- |2 f
- # Set the installation path
& V6 K+ _4 y E/ P0 S - TMPPATH=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Installation Path" \
* o" C% b! Q4 u' ?; b- E - --inputbox "Default: $INSTPATH" 8 60 3>&2 2>&1 1>&3)
. J# X5 O# u; b( A
5 A6 U9 O$ Y% F7 h8 K- # Exit if cancelled
$ K- }! q, o- w - if [ $? -ne 0 ]; then# r$ i0 L, d3 ^" ^& \# p" v
- Log "Install path selection cancelled. Only the source path has been created." 13 Q% J+ ?5 B* L
- exit 0
! G, Y/ V3 P. | - fi
* I: k' @# Z: V& _, ]/ k/ p. d
3 {6 U9 b r% Y" z# Q. _" [- # Change the path only if it was modified6 Y, l$ I* C' O
- if [ ! -z "$TMPPATH" ]; then7 w0 K5 D2 }9 V, S+ ]$ i2 _: c
- INSTPATH="$TMPPATH"4 R+ {7 S/ a: c' q& U" F
- fi
6 [! `; [9 u" Y9 i/ _1 a/ K
5 r# b. a5 h9 Y7 K- # Validate install path- n1 K8 w, W+ W6 `
- if [ ! -d "$INSTPATH" ]; then) L' j' k3 O7 k5 q
- $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Path does not exist" \9 j. K' ^9 F7 Y, W/ s
- --yesno "Would you like to create the directory "$INSTPATH"?" 8 60
/ X3 ?. o8 s# [0 t3 J - % h* s. [) x, M# ^& k4 d/ M
- if [ $? -eq 0 ];then x6 }4 \. U: w1 i h: J/ U& L
- Log "Creating install path: $INSTPATH" 13 U2 F. ~: X, [3 h% ?' w
- mkdir -p "$INSTPATH" > /dev/null 2>&1
R& @3 e4 F5 Y4 k8 {& B, ]3 P# W
% \ t5 q% @; A/ A$ A2 b3 o4 I- V- # Check to see if the directory was created$ G' n$ Y4 k0 G, W5 c
- if [ $? -ne 0 ]; then6 z" g& V6 n( r9 j4 N4 ]
- Log "Error: Failed to create the specified installation directory!" 1
% z9 X% j/ S# O - exit 1* n/ k* ^3 s* K
- fi
6 y: J; C' [1 [+ o$ X# k - else% z9 a0 i, m1 P4 O# u( {
- Log "Install path creation cancelled. Only the source path has been created."
) q6 L. \5 \+ T. c0 y - exit 03 [! S2 ~! D5 O, r5 b c
- fi: @; Y7 l# Z. d( }7 I
- else
/ |& M7 D0 i" E6 J, J$ Q3 S - # Check for an old installation! D/ {# B+ Z9 f9 U
- if [ -d "$INSTPATH/bin" ] || [ -d "$INSTPATH/lib" ] || [ -d "$INSTPATH/include" ]; then! w5 h( ^2 b: T6 ?* h, p! h
% s& }* \3 A8 H9 W2 N5 c- # Ask to remove the old installation
. v0 J: T ]# m, c; ~% j9 e6 M' n7 h, O - $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Path already exists" \
( s$ h+ t! |5 R5 P# O! X$ Q - --yesno "Would you like to uninstall the current version of MaNGOS first?" 0 00 r# v! ^9 f1 X$ g/ D. R5 y1 p
- 8 A8 g3 b& w6 W$ J
- # Check the user's response9 n' `* m2 {/ {6 ^/ [
- if [ $? -eq 0 ]; then
1 E. K: ?* F# x. | c, F - Log "Removing old MaNGOS installation..." 1: y3 A) M+ H) p" e% R
- , J$ _: G" x! H6 G
- # Clean up the binaries
5 X- Y2 `9 L* { - if [ -d "$INSTPATH/bin" ]; then
0 c- b8 \: h: f) C - rm -rf $INSTPATH/bin
0 i i0 j/ Z7 z8 l" ] - fi
0 }6 Y. H. m" Z# r" s/ h - 8 x/ Q; b; Q. F' A1 R. V2 D0 q
- # Clean up the old includes) v9 U6 v9 R6 S
- if [ -d "$INSTPATH/include" ]; then: G. F8 T& m# J+ @+ l( `
- rm -rf $INSTPATH/include1 K9 y& s# F- J% i. @% u L4 {2 {7 z
- fi. G, g6 z# M/ I. _4 Z" T5 O* o6 n/ h
- * x9 P- \9 b+ K4 _' i
- # Clean up the library files
2 ^$ J. y: {" ^5 ? - if [ -d "$INSTPATH/lib" ]; then
# H# k0 \* }: j) z3 a! D+ M - rm -rf $INSTPATH/lib" Q3 M' y1 e1 U* ?& h0 L
- fi# ~4 ^* Z4 ~7 x; W! y
$ A# t6 Y+ e1 P; ]; `- # Clean up the old logs
, i0 a6 c+ f4 t" Z8 ~. N" S - if [ -d "$INSTPATH/logs" ]; then; @$ _; W9 X0 k0 z! i, S7 `
- rm -rf $INSTPATH/logs/*
' Y2 v9 X+ w/ D0 k - fi" N$ \$ ]$ w1 ?2 A* [1 Z; o
- fi
5 J5 Q3 N. b. l% M9 v' j - fi
) ?. o4 E1 N5 U. T9 D1 ?$ v - fi
9 W4 V* D$ L" w, G - ' c9 ~5 x# q; U) p" x/ S/ `
- # Log the settings/ b* \" u# _/ h2 u
- Log "Install path: $INSTPATH" 0
0 s/ _* `1 ~, W$ _" G; [# k5 c - Log "Source path: $SRCPATH" 0
0 H: W: g9 X$ x - }
; @5 l, g0 W; p- l- M - 1 }' f( h+ M1 X' C8 |9 i7 m; n
/ X7 }# t9 F9 m1 U" }
1 ]6 O% Z7 \0 X2 E, b- # Function to clone or update sources! b; y7 E& x+ b( U4 ~. n
- function GetMangos()
! z4 z5 f% F7 @ - {+ z, s! E1 m, H5 n
- local CLONE="0"$ B, ]) l) I# I
- local BRANCH=""
, O0 G1 Z, w' b3 k3 F/ p) ? D - 1 k- B7 s. I8 t# W3 J U4 c, K
- CLONE=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Clone or update MaNGOS" \) Y C3 `+ b4 \9 a) C
- --menu "Would you like to clone, update, or continue?" 0 0 3 \! z$ B* C. h' B7 c5 r+ ^3 v. V
- 0 "Clone a fresh copy of MaNGOS" \
2 q- n$ ~0 z; t1 K9 f" K1 Q: V, Q - 1 "Update your existing copy of MaNGOS" \
: `" Y }3 B/ r, i; H5 E! G8 c# q" x1 n - 2 "Use existing copy" \+ v' w- `3 Q. `% u2 M" w j# d; h, G
- 3>&2 2>&1 1>&3)
; |3 U E( V0 P7 I* _% [ - . L1 s5 l9 S0 `
- # Exit if cancelled
: f* F. l0 x: }% r t @+ F5 L$ a - if [ $? -ne 0 ]; then
( @7 g. l" I) C; u - Log "Source cloning cancelled. Only the install and source paths have been created." 1# X% g- ?# W# W, ^1 H7 U. [3 Z
- exit 00 t* R, p0 x. q$ N( t, }
- fi( j* j* Q3 i. C) \
- ( N8 R. G' `: u i0 e0 p
- # Clone from scratch if selected
) ]) W( ?3 Z1 M7 L - if [[ $CLONE = *0* ]]; then- A0 V9 _* J9 n [! |
- # Pull a different branch?0 q4 p* z3 z6 Y5 O
- case "$VERSION" in7 p' n6 m' Z# `5 ]
- 0)
7 s% }) z& p9 q3 I" D - releases=$(curl -s 'https://api.github.com/repos/mangoszero/server/branches' | grep "name" | awk 'BEGIN{FS="""}{print $4}' | tr '\n' ' ')
6 v; N# m4 V, k+ @9 z8 F - ;;
( u2 p- o, \% y- s! P# Z - 1)
: `4 @' t: e* N: s q; J7 Q6 p+ u' K+ T - releases=$(curl -s 'https://api.github.com/repos/mangosone/server/branches' | grep "name" | awk 'BEGIN{FS="""}{print $4}' | tr '\n' ' ')
9 f+ K9 u3 {( |9 q/ ^/ t - ;;6 \& m6 f0 \* C6 m
- 2)* D6 }. c7 S3 ] h
- releases=$(curl -s 'https://api.github.com/repos/mangostwo/server/branches' | grep "name" | awk 'BEGIN{FS="""}{print $4}' | tr '\n' ' ')
" {8 D% P; _9 o w' Q- \ - ;;
8 @: @( R4 T: l3 r; l - 3)
/ k! A2 O- u& w- V) ?. t1 E: M# W" Z - releases=$(curl -s 'https://api.github.com/repos/mangosthree/server/branches' | grep "name" | awk 'BEGIN{FS="""}{print $4}' | tr '\n' ' ')3 n2 Z' z' O3 x
- ;;7 G# R9 Q" G; _$ P& n% @2 q
- 4)
* m M q" j/ |/ u - releases=$(curl -s 'https://api.github.com/repos/mangosfour/server/branches' | grep "name" | awk 'BEGIN{FS="""}{print $4}' | tr '\n' ' ')' n; [0 F8 M" m# @7 A
- ;;
8 D& F( T0 ? o. S g9 u - *)" k1 Q- t* Y$ g, l( m
- Log "Error: Unknown version to select branch" 1
C) `( B5 G) J4 P$ _& Q8 Z - ;;; `# [( {( l% ?% R
- esac" z% U& v- _7 ^0 J7 V+ V. ~
- 4 x$ a' l1 h, r! l& y2 p3 W
- COUNTER=1
3 _& q ]6 q4 b - RADIOLIST="" # variable where we will keep the list entries for radiolist dialog
' s4 l. B- G$ H- w8 | - for i in $releases; do( Y3 }: V7 Z5 j" \+ K2 [+ g- Q& Q
- if [ $COUNTER -eq 1 ]; then, ]) o" d" o, L
- RADIOLIST="$RADIOLIST $COUNTER $i on "9 D. L& l5 W3 h8 H2 L
- BRANCH=$i9 n% A- J o, b2 m# k, ^- U
- else
: z$ T/ q+ i9 G - RADIOLIST="$RADIOLIST $COUNTER $i off "
) w4 V5 n) d8 C: h. } - fi
: h0 o: w9 a' F2 f y5 ` - let COUNTER=COUNTER+1
, p# W2 U, o- Z# N - done
Z9 @, { L W1 Q
* j3 K& h- h/ P- TMPBRANCH=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Select Branch" \
1 i6 c {- K# B; |9 ~+ Z - --radiolist "Default: $BRANCH" 0 0 $COUNTER \
; x3 Q2 E3 n! e! s4 f1 \ - $RADIOLIST \' V) }' K+ B4 x" A4 R% q' U6 K
- 3>&2 2>&1 1>&3)
+ a* Y' ^6 c1 l- @1 H$ W
: Y7 }1 a7 w7 D: o H N0 v+ U/ n- # Exit if cancelled
& U6 i" A/ Z3 ~" R. Q/ I - if [ $? -ne 0 ]; then+ Z, X" r' }+ c; D
- Log "Branch selection cancelled. Only the install and source paths have been created." 1
: u. G" d7 ^ w5 }# R T- T - exit 0
* K5 P; B! p; X- ]* L - fi
: I# ? w& D. x: I4 _
& I6 y8 @# z- b! x! {- BRANCH=$(echo $releases | awk '{print $'$TMPBRANCH'}')/ [8 l- v- L7 w3 b- A
- ) G, y: Y2 W9 k& r3 R: {8 G4 E
- # Set the branch; v" Y$ k' E/ X0 W) t% i5 _. b
- if [ -z "$BRANCH" ]; then
- m6 ]: s# I0 a3 x& o7 @ - BRANCH="$releases | awk '{print $1}'"
& ~4 n! B- J- [( K5 ^' Z4 @ - fi6 h2 g7 m3 @ V" D
- 3 I/ m! w/ [$ r% u0 c; n4 ~0 `
- # Clone the selected version! ~3 l- w2 b7 b
- case "$VERSION" in
4 s4 m9 [# H; f- U- t - 0)4 n- v2 P- E. n( {" i
- Log "Cloning Zero branch: $BRANCH" 1- U- z) j4 j, `$ t: T9 ?. U8 t
- git clone http://github.com/mangoszero/server.git "$SRCPATH/server" -b $BRANCH --recursive+ Y7 b" H9 v4 Z7 D& ~$ \ I7 n
- git clone http://github.com/mangoszero/database.git "$SRCPATH/database" -b $BRANCH --recursive
2 A. H# D% C/ F2 [# F! W - ;;
5 S3 C G* o1 R8 L7 e( | - / m9 N% ^; k& ~. k+ S7 \
- 1)- u. c. ^' t0 B H% R7 _
- Log "Cloning One branch: $BRANCH" 1$ u. e' ?. c9 w9 m4 c5 M0 b
- git clone http://github.com/mangosone/server.git "$SRCPATH/server" -b $BRANCH --recursive
2 W& F- l9 M$ g: I5 x - git clone http://github.com/mangosone/database.git "$SRCPATH/database" -b $BRANCH --recursive, }% F! m6 @8 t, o" H4 M0 ~" B/ X
- ;;
& K" Q4 X X. `) S. n/ y8 I% w - 3 o% s# a+ ]" p- B0 U6 {+ Z
- 2)
/ @3 Q9 m. R( ^$ O) _& T9 Y1 u - Log "Cloning Two branch: $BRANCH" 1
# M( _: ~7 n1 c1 t8 `) _2 T4 n - git clone http://github.com/mangostwo/server.git "$SRCPATH/server" -b $BRANCH --recursive8 X7 B$ ~9 R6 c c: v6 j0 Z y
- git clone http://github.com/mangostwo/database.git "$SRCPATH/database" -b $BRANCH --recursive
! f9 l9 x) V' D; Y# ]1 p - ;;
) ]6 I, {& e: W
- I) u, U+ j6 B1 W4 ]- B4 N- 3)+ m6 X/ p8 @% V7 _) `$ l
- Log "Cloning Three branch: $BRANCH" 1
! `, O- L% h% d - git clone http://github.com/mangosthree/server.git "$SRCPATH/server" -b $BRANCH --recursive
, s' k& w& B, U% b+ q; T - git clone http://github.com/mangosthree/database.git "$SRCPATH/database" -b $BRANCH --recursive
3 N1 g/ U* [6 k/ y) g8 | - ;;
& z1 v$ j4 Y* i# @
( f; |- h! i& A6 s- 4)4 l; l$ C0 t3 }* E4 E' N# A
- Log "Cloning Four branch: $BRANCH" 1
, `, k3 t: i a7 k* H' p& @9 c1 P( L - git clone http://github.com/mangosfour/server.git "$SRCPATH/server" -b $BRANCH --recursive) q8 N& {# b3 N2 \8 O
- git clone http://github.com/mangosfour/database.git "$SRCPATH/database" -b $BRANCH --recursive
9 X) h; i7 w+ x7 `' S- t - ;;
# T: [/ p N& t% t
& p3 Q, F9 D) f( [4 F- *)
+ d8 p, @' p% Y8 _0 V7 x - Log "Error: Unknown release selected for cloning!" 1
$ W9 i- g" Y. c! z4 k3 p& Q- q - exit 1% ^* d& R/ N- b, {* }+ r3 H2 y: o
- ;;
/ P/ r( {! E/ }" X8 a - esac
* O0 q7 }9 A# ]4 I J- v - % B; c9 g7 q0 p! ?, } o) Y) a
- # Log success2 p5 g8 R7 i6 }3 f5 d* h7 @, m7 I
- Log "Cloned the selected repository!" 1
; \5 f( e; f$ V - fi
4 c0 V$ `5 a. I" N
1 v w4 Q+ ~5 ^* o# \* J5 T) Y- # Update the local repositories if selected W$ Q& r) b# @6 i) n
- if [[ $CLONE = *1* ]]; then$ ^/ ^% p4 O+ g% k
- Log "Updating your local repository..." 1
& f( ~( F L% g
" P0 Y! o" Z% N% B- # Update the core sources
( a6 {. D1 X6 ?/ T+ \; Q$ G$ R - cd "$SRCPATH/server"6 v2 ^8 |; T- w3 r* a
- git pull
( b: J7 M" y* n) a4 w2 y# H - % z+ t' }! |% s* q: j
- # Now update the database sources
X9 q/ \" |! V - cd "$SRCPATH/database"
. u' y; W0 h) e( O: V - git pull$ t: y% i0 a+ x( s
- 8 _) Y2 k4 d1 \# _' w
- # Log success
9 c8 P4 j1 B% q7 U4 N) q - Log "Updated the local respository!" 1
" k) u" ^1 |( S1 }5 P5 r - fi' @ C2 D0 t8 ` I3 u0 @) x
- 5 \' z1 h- a( d8 ~' R" X
- # use existing repository
4 I% |/ l/ z/ F: m - if [[ $CLONE = *2* ]]; then
: H" j( ? m2 z1 r, G$ Y; p g - Log "Using existing local repository" 1
* l0 C0 M( E+ ^5 H* G3 H - fi
2 p9 ]* s: L3 N0 s - }
9 N% P( V9 S% i* D3 D
& S& T0 V6 J( V$ W. K$ w4 n
4 q- O1 K: R1 N1 i/ P
6 c- M' e. i* \) n- E6 N) H- Q- # Function to set the build options
, j; X$ Q: N& m# u9 h - function GetBuildOptions()
0 g9 v9 Z6 G: X: v F' J - {, |# r; \+ i9 C7 }
- # Select build options2 z( X9 f2 i! s4 |! W B6 t- v0 W
- OPTIONS=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" \3 F% K0 X- C2 f: R
- --title "Build Options" \5 U7 j, B1 K; m. l* m. P0 k
- --checklist "Please select your build options" 0 56 7 \+ i0 h8 y" J- i" K( t5 [
- 1 "Enable Debug" Off \. K. ]4 k* a c
- 2 "Use Standard Malloc" On \/ v9 I! G3 Z O
- 3 "Use External ACE Libraries" On \
* U2 g* e8 s* p0 d5 n - 4 "Use PostgreSQL Instead Of MySQL/MariaDB" Off \, G- f0 _) J8 v- B `: f
- 5 "Build Client Tools" On \
" \( I" p$ C* C0 E - 6 "Use SD3" On \
6 `! e: H6 {' v, y* ^ - 7 "Use Eluna" On \# B) l H3 `# N
- 8 "Use SOAP" Off \& ?$ ^! A% I9 ?$ s# \! }
- 9 "Use Player Bots AI" Off \4 p6 K" k3 o8 b" o$ \$ c
- 3>&2 2>&1 1>&3); V4 M4 W2 o/ }7 P4 A
3 M# ^4 Y6 D! f9 O- if [ $? -ne 0 ]; then
/ |: u3 l1 e- K - Log "Build option selection cancelled. MaNGOS sources have been cloned." 1: L9 ?$ Q7 ^; ~" R5 @# G
- return 07 N4 J& _3 [, L4 d
- fi- P$ y2 |0 f1 a) G3 p6 Q
- 7 t9 q0 k6 Y7 j( |! P. J- ?
- # See if debug was selected7 P. }/ X& k; s! Q) H
- if [[ $OPTIONS == *1* ]]; then! `# Z4 n1 x% |- t3 ]# j9 z
- P_DEBUG="1"
, [/ K6 h( i- a+ h - else
2 a5 @0 }6 `7 d K - P_DEBUG="0" ^1 j6 o+ A% v; |: d# L
- fi
& R# p$ y* Q) P; y8 r: I: c! B
/ C* y: o$ y' P' }% I( R- # See if standard malloc was selected5 I* N$ ?) n9 L- X
- if [[ $OPTIONS == *2* ]]; then7 S, G7 C9 ]2 M7 L
- P_STD_MALLOC="1"5 F7 x6 q* A7 Y
- else
/ y: n! F7 K9 b, V2 M% q# s - P_STD_MALLOC="0"+ W+ D+ n6 O0 I/ S
- fi5 }) j' O6 } x& X. i
y4 K8 [8 G; }% H- # See if external ACE was selected5 x) R8 C+ W* C# e3 P
- if [[ $OPTIONS == *3* ]]; then2 ~) m5 V! d' C9 h8 F/ g- }' ?) w
- P_ACE_EXTERNAL="1"5 a( f# `* l3 T$ H
- else
4 w, P6 R- `7 ]* ]$ q, d - P_ACE_EXTERNAL="0"! c7 x$ k* B# Z$ f" e
- fi
# [. v* u3 h! Q4 R - % g! K W/ ?2 f0 o
- # See if PostgreSQL was selected3 h1 W8 b) x5 @6 e9 Y" b4 }+ B' f! V+ j
- if [[ $OPTIONS == *4* ]]; then% w0 Q& J, H" F% r, X. [5 W8 M
- P_PGRESQL="1"" D* q# P1 M2 Z. t0 B
- else- Y$ V4 G8 U3 X9 W' X
- P_PGRESQL="0"
; z* ~9 y. Z* X - fi
% O& D5 f% w. f
; t1 K( @6 T5 Y0 i6 z# u- # See if the client tools were selected
6 P3 a6 P- U4 x4 T# k9 b& p - if [[ $OPTIONS == *5* ]]; then, f( x! r/ d! g7 p( Z3 E; p
- P_TOOLS="1", q) ]0 e) o) v# q7 C& k8 g# f5 ]
- else6 w2 M) E# S4 S, f6 P6 c1 C7 {# ^% ~
- P_TOOLS="0"3 K0 p- g8 ]+ P) ?* o5 V
- fi
7 S8 l+ }3 m n1 i& R
( z% d/ |7 X' Q+ `% {1 `$ t8 h* ]- P, C- # See if SD3 will be used
; o2 v3 g0 v9 f9 o) V0 L3 w - if [[ $OPTIONS == *6* ]]; then' m x9 B8 \/ a: R% r3 n: w1 V
- P_SD3="1"
# _, { {0 k4 U& f - else9 Q+ K; B; `" a- G4 ^
- P_SD3="0"
, E, [+ m- W* Q* [' v: a& N - fi
1 T3 T( |5 t5 j/ g2 |, W
! X# U. \. u: \3 f- # See if Eluna will be used9 N' u/ Z, m/ E8 W# K: h) }- }6 N
- if [[ $OPTIONS == *7* ]]; then
" i4 P% E; n }5 e! T - P_ELUNA="1"
. z& I3 ~. P- j2 z) w, X {! _ - else1 Z( V, k; x' _% V/ w9 d3 @$ r
- P_ELUNA="0"
* Y: `$ i: ] H6 `% c7 v - fi8 A4 N+ {3 ^* K) u
- 2 H% u* J) M8 }- E+ C; G5 I( j5 U
- # See if SOAP will be used
0 x8 V% [* {) D/ q; }& _; A( j3 m - if [[ $OPTIONS == *8* ]]; then
. X* `/ a/ r6 ^0 E$ D' t! k - P_SOAP="1"
, m6 l4 X3 x, R# v r" ?+ l - else1 L$ ?0 ?. o9 W
- P_SOAP="0"3 y5 F' I; g% u: h% v
- fi
% }, t( ]2 ?+ ?% v' X5 [: m4 m; m
) [, T1 ?) C d( e- if [[ $OPTIONS == *9* ]]; then9 s% P( S7 r# g; Y0 r' R1 H
- P_BOTS="1"
6 e i9 x7 a% j! ]% o6 B5 x0 t4 A - else
* S. L) y/ J+ l7 f9 e$ Z- {' P - P_BOTS="0"
! {" }& L6 T) _" s; i - fi. W# x9 y+ G4 n9 E8 N
- 2 y& k5 g z2 U
- # Verify that at least one scripting library is enabled
# R9 K; r7 Z/ ~' d& s! ^ - if [ $P_SD3 -eq 0 ] && [ $P_ELUNA -eq 0 ]; then# X' A, w& @1 z, z% e& w
- Log "Error: You must enable either SD3, Eluna, or both to build MaNGOS!" 1' Z5 {) a0 m5 P: y3 w
- exit 10 P3 y4 O* L. q$ }* F* N: b$ L
- fi3 V! q# Z* ~ f( j
- }
9 s/ O& Q* v8 w- x, q - 6 z4 w' b) R- v2 w( K3 b2 t
4 \$ h/ T- P: T/ z- 3 g' s) W( V% m+ Y N% ]4 a
- # Function to build MaNGOS5 @ r d7 Q8 p2 d5 Y
- function BuildMaNGOS()6 W4 ^. _# v- M9 _5 Y8 [' i
- {) T, u9 \. \5 l4 b2 a9 c) [) Y
- # Last chance to cancel building- q3 `* F# u3 f4 S! j; t8 L; F
- $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Proceed to build MaNGOS" \8 d* Y- v1 O% o5 c$ ~. C- i
- --yesno "Are you sure you want to build MaNGOS?" 8 60
4 @7 u- w& R& o
1 V- t+ ~1 L- R8 E t- d- # Check the user's answer, x, |+ ?" `0 j2 g5 C
- if [ $? -ne 0 ]; then) k+ w( U& `* {" ^
- Log "Cancelled by user. MaNGOS has been cloned but not built." 1
2 `: L3 p: P' h' J7 ] - exit 0: D' D& Z+ Y' j4 h) f4 E- f
- fi x* e/ Z. Z* d8 S0 E) s) g
) U) S- W3 L1 P9 o; Q- # See if the build directory exists and clean up if possible
$ r$ h5 t5 M4 a& V t6 l! @5 l! H - if [ -d "$SRCPATH/server/linux" ]; then
5 Q8 X7 T/ n3 e, w* L8 F - # See if a makefile exists and clean up
- B% i, w. P9 H - if [ -f $SRCPATH/server/linux/Makefile ]; then
' p5 \, Z' b4 b7 M - Log "Cleaning the old build..." 1
; `. v% I L9 B6 a! y* M - cd "$SRCPATH/server/linux"8 v* F7 S0 z5 c) A% k' n+ G
- make clean `. w/ j1 B/ g( l6 n3 l$ t
- fi
. r5 x. D1 G' U- ]. s8 f( Z3 S( v - fi
7 r, m1 @$ d* m - 2 w/ y" `$ B9 D7 v, a/ W
- # Attempt to create the build directory if it doesn't exist
- b; ^% ?! K- K5 G' t* L - if [ ! -d "$SRCPATH/server/linux" ]; then7 w$ P( a. S( J M: Y2 I
- mkdir "$SRCPATH/server/linux"6 j4 S+ H) J) d+ P" O; a8 y
- : u$ j! D6 a- D o( P6 {4 g
- # See if creation was successful' C* V& ^: x* u' J& q% b6 v6 U; Q
- if [ $? -ne 0 ]; then
* j) w; j% N) C - Log "Error: Failed to create the build directory!" 1
7 |% E! v1 w6 x. u/ K6 E$ d2 h - exit 12 H" i- o5 U0 ?9 p& {4 m
- fi$ p e( L. o1 n8 y4 ~, |+ y& ?
- fi
0 k5 A6 k$ G) l0 P: H$ b$ x - . p T6 s4 k. q5 i4 E/ @* K3 C
- # Attempt to configure and build MaNGOS
$ U% V/ W0 K! ?# e! E - Log "Building MaNGOS..." 06 {! ?; V& B2 n! G: \2 t# U0 Q
- cd "$SRCPATH/server/linux"% f, I( Y9 {6 X0 s5 s9 |* g
- # make sure we are using the cmake31 X, ^! P* k: H4 b5 X
- UseCmake3
* e3 T2 m& N6 s; ~4 O, k* _% x - $CMAKE_CMD .. -DDEBUG=$P_DEBUG -DUSE_STD_MALLOC=$P_STD_MALLOC -DACE_USE_EXTERNAL=$P_ACE_EXTERNAL -DPOSTGRESQL=$P_PGRESQL -DBUILD_TOOLS=$P_TOOLS -DSCRIPT_LIB_ELUNA=$P_ELUNA -DSCRIPT_LIB_SD3=$P_SD3 -DSOAP=$P_SOAP -DPLAYERBOTS=$P_BOTS -DCMAKE_INSTALL_PREFIX="$INSTPATH"
5 W; Z* G% b- N - make
1 B8 V+ A: f( L) E' W& `& i - " Y5 d- ^3 E4 \( F& X# N# E
- # Check for an error
# R9 A' H# k, M# G6 E; m( N7 V5 `& H5 z - if [ $? -ne 0 ]; then
! a ~* A y6 g+ a/ D7 K/ ?4 C8 {# T! b - Log "There was an error building MaNGOS!" 1
# }: j1 N/ e9 R& z - exit 1, a/ b& Q3 P7 G: O$ A" T
- fi
`: D% U' l* X0 k0 E' y
! k( x8 C8 l" b' `* t- # Log success% f% z9 m1 |' x* t. @1 D1 y; D
- Log "MaNGOS has been built!" 0
/ t2 b% m5 b7 c - }- O8 @0 _* w$ s! H
- , v; N$ O: U q6 y$ G& `
- 7 \) i6 u) W1 }; w: m$ K# k+ V/ l3 Y
5 |3 S& g5 z0 Z, a: P0 ^ k- # Function to install MaNGOS2 ~( A$ a! v S% X2 T% a$ I
- function InstallMaNGOS()
6 M+ T% n0 K5 j4 _( R. d - {0 W0 L9 x% Q) c. t: s' q# D1 G
- # Ask to install now3 H* J N1 d7 C6 W% Z4 M( C) e& g- Z
- $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Install MaNGOS" \
6 x" [1 a2 ~3 M3 Q( s - --yesno "Do you want to install MaNGOS now?" 8 04 n9 H1 ?, s4 H1 O
( s( y0 q4 w* w9 A# t) |2 k4 t- # Return if no! L% i6 y- Q! O) l7 D. x- S
- if [ $? -ne 0 ]; then
$ I- u# H- N7 b( j+ `3 }. I - $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Install MaNGOS" \
: R# V7 b& [5 M( V) L - --msgbox "You may install MaNGOS later by changing to:\n$SRCPATH/server/linux\nAnd running: make install" 24 60
" i5 |) C5 E" P3 N
: n0 S/ X# {5 i$ ?: r& _2 B# v- Log "MaNGOS has not been installed after being built." 1
! |5 v/ r6 s; y' [. b. H - exit 05 [0 O# o% i3 Z2 a b
- fi
3 g- H) J& n7 O0 k - : U% T0 _8 R/ q( a
- # Install MaNGOS; b2 L7 u+ X% p: t( U. G
- cd "$SRCPATH/server/linux"7 S0 G; I- g5 R; `. o* a
- make install
( n) x. x& l5 E% b% y - $ |( i$ C0 k, @- F
- # Make sure the install succeeded
/ g1 n6 k/ J; k# k! X h. C& c - if [ $? -ne 0 ]; then: [" E, B1 J: @4 \* m! a$ w
- Log "There was an error installing MaNGOS!" 1
2 }8 W* m; g% x% S1 ^- w- F - exit 1( z! M- Z! {; j" x( k+ Q g5 d
- fi1 R, V% J0 i& Z; B
- }
& t, s$ k/ I, _- ~: G
# H5 c( P O+ g( Y- # Function to apply database updates/ t- X% p2 @8 n) C4 p
- function UpdateDatabases()8 B; r2 n) W8 ?6 k
- {% W: f5 f/ q( ^6 d1 `- f
- local DB_HOST="$1"
8 u5 ?/ v5 c4 Y7 { - local DB_TYPE="$2", Q; ]$ J# n. X; @- r
- local DB_COMMAND="$3"6 q3 N2 G" E2 }
- local DB_USER="$4"
" i: ]3 r @- k; |; F2 M- {0 p5 Z - local DB_UPW="$5"3 Z$ p: d( J% R C6 c
- local DB_REALM="$6" {" D3 N! I. ^: w! @' W
- local DB_WORLD="$7"
' k3 b, b0 Z4 l - local DB_TOONS="$8"
! N6 W; ?( i. s' _6 l - # k* {5 e$ f8 h8 _* O* I; r
- # Loop through the character files
- ^2 [+ @7 ?$ P2 Z w3 _* ]" U - for pFile in $(ls $SRCPATH/database/Character/Updates/$(ls -a $SRCPATH/database/Character/Updates/ | tail -1)/*.sql 2>>/dev/null); do/ f& C! J" C2 m# S; R
- if [ ! -f "$pFile" ]; then, \8 y: k9 D: \8 V8 V/ v9 p, l
- continue
" z4 `6 A4 c2 D" C/ g' F- m' f - fi
$ C, @5 c$ B; a, Q# T; G - # Attempt to apply the update
) R+ h- D" i8 v8 o - $DB_COMMAND $DB_TOONS < "$pFile" > /dev/null 2>&1
7 }1 J/ [2 v) @7 } - A# ]" t$ D0 |% b& `' ]& B% P$ l
- # Notify the user of which updates were and were not applied9 @! G1 ?9 _3 S$ C
- if [ $? -ne 0 ]; then6 C1 Z+ `& T$ }6 z) n) B2 b
- Log "Database update "$pFile" was not applied!" 0( X6 N6 D5 `* H# p9 p; O+ B Z% Z2 G
- Log "Database update "$pFile" was not applied!" 1
1 m5 ]2 P( e" h. P& s - else5 f/ N3 m9 T$ I5 K
- Log "Database update "$pFile" was successfully applied!" 0
; v/ w) h1 G! d; F6 r! [( S - Log "Database update "$pFile" was successfully applied!" 1/ a, `2 X" f+ y, H, _' N
- fi5 y1 j' S5 Q3 |( Q) T. b# g
- done
+ W1 u$ f% Z9 ?" K8 O( u3 N - - H! I3 p I; \* A9 J
- # Loop through the realm files' |& D5 C: x3 ]
- for pFile in $(ls $SRCPATH/database/Realm/Updates/$(ls -a $SRCPATH/database/Realm/Updates/ | tail -1)/*.sql 2>>/dev/null); do' u* E1 f5 H! m2 Y
- if [ ! -f "$pFile" ]; then
9 ]! B' v( y# H: e! |7 t" W9 g' i - continue
# Y9 `) E4 {7 X' { - fi8 F- e8 G4 J8 B8 J
- # Attempt to apply the update2 ?& R; s. L: v, v
- $DB_COMMAND $DB_REALM < "$pFile" > /dev/null 2>&1
! ~1 u, ?& h4 x( g3 Q, ~; V
/ E/ g+ L; w0 M# e$ i" n- # Notify the user of which updates were and were not applied& @4 n! m# O: ~
- if [ $? -ne 0 ]; then
5 M c6 f# O& x |8 l - Log "Database update "$pFile" was not applied!" 0 Y. n0 Y. n# a4 U2 G3 U; i
- Log "Database update "$pFile" was not applied!" 1& R* |: A0 ]4 R# F6 n
- else
: W B5 t+ K9 B - Log "Database update "$pFile" was successfully applied!" 01 R6 j/ x4 V3 n: W+ M7 C
- Log "Database update "$pFile" was successfully applied!" 1* M, c9 Z: g) P* `3 Q! J
- fi
( B" O3 D) E# L* c" i - done- }0 o) f7 a1 E; I# h
- - e7 J& M/ @0 _& k; Z% f
- # Loop through the world files& A- T+ G, @! v3 n
- for pFile in $(ls $SRCPATH/database/World/Updates/$(ls -a $SRCPATH/database/World/Updates/ | tail -1)/*.sql 2>>/dev/null); do+ i" W/ i% N9 |; `7 x
- if [ ! -f "$pFile" ]; then( d; j1 ]9 v+ G$ K/ H0 U# l
- continue
# I% ]; e, q. z. Z2 }' t. W - fi+ \! P8 Z: w. \( y1 Q4 D4 J
- # Attempt to apply the update, R& `% g% e- ?$ G* F# k( k6 Y
- $DB_COMMAND $DB_WORLD < "$pFile" > /dev/null 2>&1
% x! U$ g$ `5 h- a6 M- `/ m# w4 y - : t( X. t- X) B9 w, ^, C
- # Notify the user of which updates were and were not applied l$ O. X! S; Q7 D! A9 e$ B0 R q
- if [ $? -ne 0 ]; then* U, r' z! m$ h2 C0 }! Y
- Log "Database update "$pFile" was not applied!" 0& q. W6 W' c3 b, l8 t* g8 \1 I
- Log "Database update "$pFile" was not applied!" 1% }% ? J: g% c7 {' D
- else
4 T$ b# H8 G H5 t) Z; X- }9 a5 R - Log "Database update "$pFile" was successfully applied!" 0
4 Q* A4 W3 u+ V9 |2 ? - Log "Database update "$pFile" was successfully applied!" 1
& G2 x/ J# F7 a& K! W - fi! I( ?# d a* R0 H
- done5 ]7 B% E( ?. X
- }
& a+ }0 A/ @7 n
6 B4 E: m9 h0 j8 \) j0 {- # Function to install or reinstall the databases6 V! c% o& m$ _, f! y; v
- function InstallDatabases()" r2 B# f( S& {. ?* B% `) L
- {7 S. |$ R) F9 T+ W( l1 T
- local DB_HOST="$1"" @8 n7 j" \8 H7 I
- local DB_TYPE="$2"
; s( j' S0 ]- p5 H/ P0 P* M! Y - local DB_COMMAND="$3"- G1 V. {, g" g9 T8 b$ X1 J/ K
- local DB_USER="$4"! P$ L( ^, A: ]; j0 R! S3 A+ V2 m7 p
- local DB_UPW="$5"
6 }1 }* P3 e9 W1 `/ v4 n - local DB_REALM="$6"
8 p8 z' Q/ d$ l: E1 L - local DB_WORLD="$7"
P# {# A- m! s9 g7 e+ U - local DB_TOONS="$8"0 T' I- {4 K8 j, f! H% m
) Z' s% ~- s! |9 `, {/ G- # First create the realm database structure
8 T. b/ V, a' a, ~0 a4 o/ r! t - $DB_COMMAND $DB_REALM < $SRCPATH/database/Realm/Setup/realmdLoadDB.sql( v+ Q: i3 D! @0 D3 ?9 F
8 j' t; A) x( G# I: i- # Check for success
+ M+ _* `- D/ _3 w - if [ $? -ne 0 ]; then6 |" `, o6 a6 F) p8 \* U
- Log "There was an error creating the realm database!" 1+ w9 A; y6 D7 f G9 F+ i
- return 1* p1 i+ O& u2 N4 p$ A# p
- else
+ W p9 ]5 v, D4 M" Z1 D' E L' C - Log "The realm database has been created!" 1
& z" Q* L* q0 i9 L' i# r - fi5 X/ g; w6 }* {$ Y5 x9 O
/ d5 l# E) x8 \; g! D- # Now create the characters database structure. ~4 w$ E z7 S1 p) D+ A6 O. p
- $DB_COMMAND $DB_TOONS < $SRCPATH/database/Character/Setup/characterLoadDB.sql; J: a) ]% t4 F# I5 m
$ Z4 }7 s$ t' P; O/ l- # Check for success
0 W i+ C# ^ Y% m# N - if [ $? -ne 0 ]; then" r8 w9 `' w% k9 y! s+ O+ u5 n* B$ ]6 v
- Log "There was an error creating the characters database!" 1
4 w$ b3 a3 i" {& v. `% j" S7 c V - return 1
& X7 b6 x' d$ j- `0 C/ e( a8 `# V - else
( K" }9 Q/ e% u$ Q$ C( j8 i/ u - Log "The characters database has been created!" 1
; A) J* |, e; O% }- v i; M - fi
7 B$ p9 b; x4 K& Q
8 A- G: g. M/ K* W; n- # Next create the world database structure6 d% { f0 b6 `0 [" r! S( f# ~/ m# S9 C
- $DB_COMMAND $DB_WORLD < $SRCPATH/database/World/Setup/mangosdLoadDB.sql3 c2 b* V: R4 l0 k
& h" W( h! Y& d/ D- # Check for success: ^/ e8 Q0 o& ? C( w# _
- if [ $? -ne 0 ]; then
V' R3 ~4 L: z! p - Log "There was an error creating the world database!" 1
: j% t4 @' p" b8 `9 R - return 1
& w& k4 t7 S7 j5 k' K7 m% b( F - else0 i( F) w5 z6 f/ p: l
- Log "The world database has been created!" 1' S- j4 S0 r( A4 A$ y j& K9 I
- fi( h9 [7 L5 W- |7 k7 G
- 4 p9 K/ |, P% K W
- # Finally, loop through and build the world database database: D2 }# z5 L5 _+ j, t+ ~
- for fFile in $SRCPATH/database/World/Setup/FullDB/*.sql; do
) a. X2 {% U5 v6 X. E o# Q* B' | - # Attempt to execute the SQL file" {8 I) S& W* X' i
- $DB_COMMAND $DB_WORLD < $fFile! f, w- @/ W8 {: y( D4 K3 H
- & O& E E0 ^5 U7 R2 F
- # Check for success: a( y. C' ^% x- q. I
- if [ $? -ne 0 ]; then9 j6 O- }9 |- Y- Q$ V8 W; U; x
- Log "There was an error processing "$fFile" during database creation!" 1
# e6 R& C- w8 j/ I+ E' f; R4 O# d - return 1 Y6 I: A- b% k M. t' j+ P
- else
7 G/ t& Z" j8 M4 U5 I/ p! |/ d - Log "The file "$fFile" was processed properly" 1
5 E7 K- Q$ d7 ~7 F - fi
( Q8 F) l3 C- x) h/ t0 g - done: `9 P2 W7 j9 q, n
- , ~+ b; u) `( G1 X& f5 _5 w) {
- # Now apply any updates3 v' }2 s4 k5 ~0 o, A; h3 [
- UpdateDatabases $DB_HOST $DB_TYPE "$DB_COMMAND" $DB_USER $DB_UPW $DB_REALM $DB_WORLD $DB_TOONS
1 d$ L2 w& R, A# j5 i - }
: f& j1 b0 |& X7 J1 S4 M - : n& ^# s+ ~" V& t3 w/ o
- # Function to install or update the MySQL/MariaDB databases) w5 W3 D n, z# @( t9 P
- function HandleDatabases()
2 w3 A( L: t8 { - {
0 u4 P3 U; ^5 f$ E& G" r+ N - local DBMODE="0"
/ u# O$ _$ J2 b, O. b) r7 w& m r7 O% J - local DB_TYPE="0"" E5 v; h+ Z; ]% c' S4 w
- local DB_COMMAND=""
6 D5 x. |* m1 J# o4 R Y - local DB_TMP="0"
! K2 R1 i" Q, l2 D - local DB_USER="mangos"
" m0 F- Y" b# o/ N, I - local DB_UPW="mangos"; ]5 U# i F( ~/ a. c0 V
- local DB_HOST="localhost"
- A, m9 u% v- K - local DB_PORT="3306" e7 S- f4 z, Q x& v
- local DBSEL="3"$ B4 [) `4 {, a' R
- local DB_REALM="_realm"' |) w. }: q3 [- L' U; e6 j3 S* V+ Q
- local DB_WORLD="_world"
8 u' h7 {( f0 A0 ^( a7 `8 B - local DB_TOONS="_characters"( D6 q; z* ]2 {5 y5 |' b* d
- , h1 S) I9 S9 d, J+ D6 @ l
- # Ask the user what to do here
8 q# }# Z5 b% S1 p1 q - DBMODE=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database Operations" \
) `) o5 G; z- p& [9 Y% }- m2 c - --menu "What would you like to do?" 0 0 3 \' }5 N! y( T2 R3 d @* _" o! K
- 0 "Install clean databases" \
+ t* M# {# V$ e& f7 k( |( d - 1 "Update existing databases" \! z" ?0 Q. f# ^7 ]; }( A! ~
- 2 "Skip database work" \$ |' `8 n! D( I( n) ~" D% q- j- F' I
- 3>&2 2>&1 1>&3)3 f$ b4 Q: c) }/ T
; t8 [" A' z7 _0 J8 i9 b A- # Exit if cancelled8 L# p. h0 y0 e6 s, k
- if [ $? -ne 0 ]; then
- ^2 H# r8 u; w4 `8 H" p0 q+ V - Log "Database operations cancelled. No modifications have been made to your databases." 1" E9 F: y8 e. Q
- return 04 N% I( B' N( C) L0 H3 L0 p% r6 s n
- fi
. l8 s+ A/ C( X7 ~+ r+ C6 q2 q
) W4 K4 t1 j: j( J( N/ L- # Exit if skipping
8 {* h/ B+ I% d; S; j1 m/ W - if [ "$DBMODE" = "2" ]; then' u7 j- F9 W d) ]% [9 c0 E7 K5 ?; q8 J
- Log "Skipping database work. Nothing has been modified." 1
1 ^9 }, G( M8 U0 a9 A - return 09 _0 S7 r8 @+ v2 l- D1 G
- fi
& {; Z1 m& V+ e' ^6 ^
1 ~4 K( T" |+ R8 A2 Z- # Ask the user the DB type
* X% m9 v" `. }( K. \& ?% V, K - DB_TYPE=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database Type" \
+ ~) ^1 s l* E2 \ - --menu "Which database are you using?" 0 0 3 \9 Z* t- D3 M$ o& A: Q
- 0 "MariaDB" \4 w; L; l5 u. f9 j
- 1 "MySQL" \, m. Q G( ~% W- J) P) N2 @! x
- 2 "PostgreSQL" \5 o' `2 U+ S- J8 H9 ~3 M
- 3>&2 2>&1 1>&3). U( m5 E6 {( M: @
' s8 R9 Y$ Z3 I' O- # Exit if cancelled
! W4 \0 k, i+ f, C - if [ $? -ne 0 ]; then) f G8 a& d! W& S8 I6 J7 Z
- Log "Database type selection cancelled. No modifications have been made to your databases." 1
# b ?6 n) _7 ]' O - return 0
& E* r$ l: Q0 B) j - fi5 t* L) }' R! ]# S: T
- ) t; N' h6 M M" P
- # Get the database hostname or IP address! ] J4 \0 Z4 C& e9 |
- DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database Hostname Or IP Address" \
$ ^ \7 q- _- O - --inputbox "Default: localhost" 0 0 3>&2 2>&1 1>&3)5 R0 K* L' x6 J8 w" [' n
% U/ D( l; o' [8 F" R& m- Z- # Exit if cancelled
]9 a9 ^/ i% F- J& n7 ]6 G3 ^8 n - if [ $? -ne 0 ]; then
: ^- M; y( T' p - Log "DB host entry cancelled. No modifications have been made to your databases." 1
) C. d I9 [0 t0 Z3 o7 z6 _# i - return 0$ i' b }* m- e% r) ^4 O* Q# ]
- fi
7 {2 n; N2 z0 X! Z. d
7 \$ ?" M- L% V8 U- N: ^- # Set the hostname or IP address if one was specified( M0 j7 I# a# k6 F# }
- if [ ! -z "$DB_TMP" ]; then
3 I, S) C3 ^# i4 K/ m - DB_HOST="$DB_TMP"1 H" K" Q0 J! m! c4 j# d
- fi( S( b. T: Z& m+ s
- 2 y4 r8 H: D6 u5 F
- # Get the database port+ _$ t* s/ S1 g. z; b; m
- DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database port" \! x8 B5 p% O% d0 [
- --inputbox "Default: 3306" 0 0 3>&2 2>&1 1>&3)
( r: k5 q; J; m9 H - 0 |% v, ]) Y' X7 q
- # Exit if cancelled7 a/ g3 s2 J4 V- p+ {
- if [ $? -ne 0 ]; then
6 E1 m/ }9 e p1 C - Log "DB port entry cancelled. No modifications have been made to your databases." 13 _2 ~& V' \6 n
- return 0/ i: Q l4 X1 c8 O" ]+ s* d" L/ H1 ~
- fi7 c5 h: q e. S
+ N3 }) N, {4 @: {% v$ U, B- # Set the port number if one was specified
; D+ V) H, o) _5 v- N5 D; ? - if [ ! -z "$DB_TMP" ]; then
2 m4 ?; x8 \+ L5 x2 e - DB_PORT="$DB_TMP"1 v* f( r' x9 X$ r" @% ~; j
- fi
9 e$ e: `) N5 G
9 ?6 y0 C/ T2 r5 F" Y* A+ }- # Get the database user username+ T( }8 }# a X0 d, l
- DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database User Username" \' G1 }3 }6 ^: k) r6 J5 {
- --inputbox "Default: $DB_USER" 8 60 3>&2 2>&1 1>&3)
$ T' y/ p% |/ c" W6 X - 8 W }0 C& f# J W5 j+ E
- # Exit if cancelled
M; U9 R4 g1 K4 J - if [ $? -ne 0 ]; then
) A% ? u. o' b* H* r, {7 e4 z0 a - Log "DB user name entry cancelled. No modifications have been made to your databases." 1
/ v# g5 i$ R k1 W) v) R - return 0; B& |+ J6 B# c8 k7 y. r! v
- fi0 X7 Q6 T1 L0 p3 ]* Y* ?" D
8 d7 x5 b# J0 @; m# O7 j- # Set the user username if one was specified, a; F; p9 m4 k/ X! ^$ [
- if [ ! -z "$DB_TMP" ]; then
& x2 U: S2 [; e - DB_USER="$DB_TMP"6 ^. |. \! M" r0 u2 Z: J! F. n! X! U
- fi$ b( _& I+ V" h1 ?0 ?1 [ Z- J
- : z: @" K7 ]0 Q6 V9 ^ P( ?
- # Get the database user password
9 v1 y1 o. Q' h! r; y - DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database User Password" \
Z8 o) K$ q7 A! E - --passwordbox "Default: $DB_UPW" 8 60 3>&2 2>&1 1>&3)+ F6 {7 o* |5 o9 U% T/ Q! f
& g7 Q, s+ a6 F9 P8 d$ t9 Z- # Exit if cancelled
' `6 X4 e& B. u: b0 c# I/ { - if [ $? -ne 0 ]; then8 J/ Z0 B6 r! ^* S
- Log "DB user PW entry cancelled. No modifications have been made to your databases." 1/ S2 o! _/ c7 C U" e) U, N- I
- return 0
7 Y% K8 t) V0 g( f; ~. K8 P - fi
$ M* R$ Y# y* V( q% Y) L3 F
/ I0 m: Q2 J4 {+ Y- # Set the user password if one was specified
. D( J7 Y$ v9 ?: N - if [ ! -z "$DB_TMP" ]; then
" Y1 C7 G: u4 `4 i - DB_UPW="$DB_TMP" V. a( a2 O. Y" `3 A. F6 t; l
- fi
% C3 O* L6 l9 `7 t$ j C' S( } - ! B' z: ^: T x& j3 `, }
- case "${DB_TYPE}" in5 Q/ m( a2 X5 N; H$ Y
- "0")3 M0 A' `2 f6 m" E, r
- DB_COMMAND="mysql -u ${DB_USER} -p${DB_UPW} "/ b+ P) ?- R5 Y& H
- ;;3 K$ u4 K) ?6 F# [& V1 t2 c
- "1")
2 J& O8 r7 y b* f% v - printf "Confirm your MySQL password\t, "% J' X- g; C8 M- H
- mysql_config_editor set --login-path=local --host=$DB_HOST --port=$DB_PORT --user=$DB_USER --password --skip-warn, u9 n' l/ D% \* z$ Y$ P, r5 `5 |& p
- DB_COMMAND="mysql --login-path=local -q -s "
2 Z8 h6 i4 W" [! [+ K8 a - ;;
$ S) A4 ^! T# ] - "2")
+ M1 ?' U; [& M - Log "Currently not supported." 1( s O+ p# _. g$ a' F
- return 0# t; m6 z! n8 ?4 Y
- ;;5 f' o9 Y( I1 h% I; A
- esac8 q. u' M) E# r6 n/ ]8 t7 Y7 A
* F# r; w+ M( ]* k& g3 h1 X- # Setup database names based on release: g6 m! Z1 o( O5 E, B
- DB_REALM="$DB_PREFIX$DB_REALM"+ B' ]8 A: d9 S9 e5 H
- DB_WORLD="$DB_PREFIX$DB_WORLD"
: t* i% I/ w* }+ {1 j - DB_TOONS="$DB_PREFIX$DB_TOONS"; o3 X% x- t9 Y4 K. z! n
( ^1 }; b% S: e$ W( H/ G- # Install fresh databases if requested
- a. g, O% x% Z' E - if [ "$DBMODE" = "0" ]; then) f( U. D7 x* w8 j# y+ i7 P
- # Ask which databases to install/reinstall! k; }9 V, U9 }* D) E( p
- DBSEL=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Select Databases" \# `6 b, w+ [5 f1 C. Q2 g) P
- --checklist "Select which databases should be (re)installed" 0 60 4 \* S5 F" @& q; W7 l; U" G
- 0 "(Re)Install Realm Database" On \
5 Q7 {0 T' v2 P+ u5 w& H - 1 "(Re)Install World Database" On \
6 o( P( G2 K- b# A% U7 B. z) { - 2 "(Re)Install Characters Database" On \9 @6 l" O6 m! y1 D+ e. q
- 3 "Update the realmlist" On \, X: a: Q% v4 G5 m3 z5 ^
- 3>&2 2>&1 1>&3). V5 a' S. s, U9 d3 E
& U' k6 ?7 f+ v+ q ^- # Exit if cancelled5 \( P' r$ z/ A' ?
- if [ $? -ne 0 ]; then
: j6 A8 g5 r x) b' [# l - Log "DB selection cancelled. No modifications have been made to your databases." 1- `7 T. |' C! E; a9 {+ @3 E
- return 0
" u0 d5 s, P5 o+ ? - fi
8 \2 E/ q) g* ^, e - . { G9 _3 f/ [
- # Remove and create the realm DB if selected
0 w; Z U% U! \$ ]* U' ~) d# G - if [[ $DBSEL == *0* ]]; then
3 y9 k1 M# I" J, h* E - $DB_COMMAND -e "DROP DATABASE IF EXISTS $DB_REALM;"+ f2 p% | G0 L
- $DB_COMMAND -e "CREATE DATABASE $DB_REALM;"* l% O4 r) v7 |, T @- O
- fi
& e5 K8 n% o7 T% `
4 f8 _1 H k8 s5 V4 J& { R# ?- # Remove and create the world DB if selected
/ s: H' }% p1 L - if [[ $DBSEL == *1* ]]; then- i" \8 s2 u; R* `+ r6 p' ]
- $DB_COMMAND -e "DROP DATABASE IF EXISTS $DB_WORLD;"5 H n$ q$ X" [$ B; D
- $DB_COMMAND -e "CREATE DATABASE $DB_WORLD;" ]9 ]) t8 J& `" l, x0 Q
- fi0 W1 R" b7 \. j0 s9 [8 v6 P/ E' A" W
- 4 u" H1 J L( [4 x$ w0 Z% k' E9 q
- # Remove and create the character DB if selected
, f& Y. Z; c+ w2 M - if [[ $DBSEL == *2* ]]; then5 ^2 C/ B2 @; R* z
- $DB_COMMAND -e "DROP DATABASE IF EXISTS $DB_TOONS;"
( d# _! N5 D! e1 r+ \% W G( F - $DB_COMMAND -e "CREATE DATABASE $DB_TOONS;"& F, |+ n* B' L( L8 _: ~
- fi1 T' E. u; s1 c
5 x4 B$ \+ x7 `9 ^" m6 X# {* Y! V- # Validate success" F7 S; b1 d: b/ v, k3 ]" I# Z- ]
- if [ $? -ne 0 ]; then! v5 q7 k$ g( A/ h4 j% v4 b) C
- Log "There was an error creating the databases!" 1+ }0 I5 b; g% I# A0 Q
- return 12 ~7 {) T$ t! l- g* V) C
- fi: e8 ?4 j/ ?1 Q- _
- ' g& l, R$ M, o) A/ Z9 _
- # Finally, populate the databases
y2 c6 \$ `8 {1 w - InstallDatabases $DB_HOST $DB_TYPE "$DB_COMMAND" $DB_USER $DB_UPW $DB_REALM $DB_WORLD $DB_TOONS
" v* P" i& @0 x9 ~6 h9 c/ f6 Q - - B7 v, _/ B* m6 V! z$ ]5 B
- # Updating the realmlist
/ R3 \+ C2 w' l3 C, e - if [[ $DBSEL == *3* ]]; then
0 _# \+ n2 Z5 r, n - $DB_COMMAND $DB_REALM < $SRCPATH/database/Tools/updateRealm.sql
+ Z' p' e/ z8 T - fi
# [2 |' J# W& c7 E5 z. N - fi
! f2 P- A1 e! t; @4 V" Y% t* q4 n8 s
. e0 H( O4 c( E$ ^% W1 N7 Q: k- # Update the databases if requested
( R! M+ g7 y( G3 l - if [ "$DBMODE" = "1" ]; then+ S, {$ {7 q% ?/ _6 P% o2 ~
- UpdateDatabases $DB_HOST $DB_TYPE "$DB_COMMAND" $DB_USER $DB_UPW $DB_REALM $DB_WORLD $DB_TOONS
% q' ?: K+ E4 l1 ]% j+ p" F - fi
+ V! |9 L4 e0 \2 @ - }
- p0 Q6 X. l+ E - / s3 V& T D3 d
- # Function helper to extract resources (mmaps, vmaps, dbc, ...) from the game
w, h& v6 J+ \. ?, v - function ExtractResources
/ D! K" y; x1 b$ i4 I1 k! K - {
) d, G7 J+ {* Y+ @% v, x - INSTGAMEPATH=$(dirname $(find /home -name "WoW.exe"| head -1 2>>/dev/null))0 q' a1 {; J H% N' u
- 5 C8 g) A9 G: u5 ^& M" l9 `
- GAMEPATH=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "WoW Game Path" \
9 l/ F3 R( C6 g$ R0 \8 h" _5 | - --inputbox "Please, provide the path to your game directory. Default: $INSTGAMEPATH" 8 60 3>&2 2>&1 1>&3)5 h# `) [5 e* A" c& i
( D1 e5 A: o4 I1 M! c- if [ -z "$GAMEPATH" ]; then
. E! P- ?7 E1 j9 k4 Y: K2 F - GAMEPATH="$INSTGAMEPATH"2 u# T! O: k1 J
- fi
$ s+ Y1 l4 r; Q - : G/ F% q \" e @+ l
- if [ ! -d "$GAMEPATH" ]; then
+ h/ X# ~, S9 d" I$ t. W - Log "There is no game at this location" 1
9 X1 T* f& s$ H5 @' r# r - exit 1
2 p2 g# [# }4 \6 r' w - fi9 i9 q$ T/ Y( w) y1 t2 {$ N
& r6 G: F& F6 t2 Q7 K- ACTIONS=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Select Tasks" \# H/ N& l( j1 k, h5 G& V$ B4 ^
- --checklist "Please select the extractions to perform" 0 70 3 \1 a _: u- d2 r3 t
- 1 "DBC and Maps" On \3 F& Q- J$ I2 o. L
- 2 "Vmaps" On \
: B; ^2 l0 Z: t4 a, B+ W - 3 "Mmaps" On \3 o0 ]5 M- s9 k" w+ X. @' e* p, r
- 3>&2 2>&1 1>&3)
* K7 b& i4 z2 s+ p* ~
: v3 j U% A3 p& n- if [ ! -d "$INSTPATH/bin/tools" ]; then
4 P! U' p! |: v& B - Log "The client tools have not been built, cannot extract data" 1
; W! v7 a/ j' S3 C5 o0 K0 | - exit 15 P0 O8 W7 I" {
- fi
Q! h# b& o. V# z" F
9 i% }' h# R8 z) x+ g- #TODO What if DBC are not yet generated ??
1 ?7 ^" S3 y# x, \3 Q- w - if [[ $ACTIONS == *1* ]]; then
6 F- m' ~- C, @" Y9 k; I - if [ -d "$GAMEPATH/dbc" ]; then
, y" t8 o0 |) { - $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "DBC and Maps were already generated" \# w- A u3 B8 p6 c: c* h
- --yesno "Do you want to generate them again?" 8 60
0 H5 g6 h+ M0 i7 n, X
) t0 P3 ^- E+ A3 `! L0 c# o- # Check the user's answer
8 Y5 P/ @+ K* u3 z' H9 b: ~ - if [ $? -eq 0 ]; then
+ f% [7 ]( W1 J, O$ L1 p! t. l - Log "Deleting DBC and Maps previously generated." 1
! f: m- c8 p% M e4 [) l! q1 i8 M - rm -rf "$GAMEPATH/dbc"3 K, I5 H- z' ?# G" T
- rm -rf "$GAMEPATH/maps"3 B; {3 U7 f) t+ d
- {. S1 H% f7 W. H: \7 w* B! B- Log "Copying DBC and Maps extractor" 0
s% C) ~) j7 }) c - rm -f "$GAMEPATH/map-extractor"
0 G- B0 l* Y. b3 {" \! f; \- h - cp "$INSTPATH/bin/tools/map-extractor" "$GAMEPATH"
7 n4 ^6 G; R& J% p& l9 r - 0 p$ W3 g, ]- q! r3 E
- Log "Extracting DBC and Maps" 0+ d( C: \8 Y4 h) h8 z
- cd "$GAMEPATH"' J! r3 j' q4 w/ \5 v* ~+ t/ t
- ./map-extractor# @) e, H; Y$ |: ?- Z" A; s
- 0 w4 Z$ j7 z7 B
- if [ $? -eq 0 ]; then9 g2 t. C6 P7 ]
- Log "DBC and Maps are extracted" 0
: Q% S, m9 u7 Y% @ - Log "Copying DBC and Maps files to installation directory" 0
/ ^" Z ]) o [: I8 z( k7 u8 F - cp -R "$GAMEPATH/dbc" "$INSTPATH/bin"
, Q; }6 \# \: G+ z' W2 q$ b - cp -R "$GAMEPATH/maps" "$INSTPATH/bin"; e3 l0 |; P) ~, @4 n" q- N; P, b" C3 {
- rm -rf "$GAMEPATH/map-extractor"
2 U. n3 ]* I5 g! n: O$ R ^ - Log "Changing ownership of the extracted directories"
" J/ I; b7 \- t* l8 s - chown -R $USER:$USER "$INSTPATH"( B3 {- \6 X, ~8 a
- else
' l ^, T9 p0 X% S - Log "There was an issue while extracting DBC and Maps!" 18 B! u3 O) W; s* G% C2 K) A
- rm -rf "$GAMEPATH/map-extractor"1 w6 [9 P: e! O: c2 |
- rm -rf "$GAMEPATH/dbc"5 H j) W( A9 H Y1 B
- rm -rf "$GAMEPATH/maps"* h/ }2 e3 n$ |$ b4 d
- exit 1/ W7 _! y; n# J) g$ Z3 o- y
- fi
9 I' O4 K( y4 C$ r$ k0 q - else
1 ^: C5 q1 G! e& ]! \: D( l - Log "Copying DBC and Maps files to installation directory" 02 T2 Q0 `9 A2 K0 z
- cp -R "$GAMEPATH/dbc" "$INSTPATH/bin": N8 s" i% R" v+ ?# c& d
- cp -R "$GAMEPATH/maps" "$INSTPATH/bin"% C9 p7 H6 F+ v+ W/ G
- fi& i# X2 X& R t5 q& z3 V8 v
- else
4 x0 k3 U: g3 F' d: y; S - rm -rf "$GAMEPATH/map-extractor"! i( f4 ~" e7 M
- cp "$INSTPATH/bin/tools/map-extractor" "$GAMEPATH"6 p# A/ B$ _- D% t
" V$ f6 D: k. z# E- Log "Extracting DBC and Maps" 0; R2 P' x E& [9 P* P2 j! n3 r+ v
- cd "$GAMEPATH"
! I. n& R4 g- R) c! F Q1 z* q& J - ./map-extractor2 s$ N; l: ?. v7 G: F' X. _/ {
I, i9 g% ^. ~! w- if [ $? -eq 0 ]; then
( o" k" F$ y3 O! D( ?7 d* r+ P - Log "DBC and Maps are extracted" 0
4 B7 {( k# s$ g: u8 c3 R0 }9 ^$ C0 [5 q - Log "Copying DBC and Maps files to installation directory" 0
7 _) A- b# `: r: p ? - cp -R "$GAMEPATH/dbc" "$INSTPATH/bin"+ z; o4 K, |& i5 R: u3 F7 e
- cp -R "$GAMEPATH/maps" "$INSTPATH/bin"
* P* e, L& w- V8 e2 |; Q9 Z1 x - rm -rf "$GAMEPATH/map-extractor"% x9 P% r/ b5 l' p5 t; e, r5 q
- Log "Changing ownership of the extracted directories"3 V J4 c" g7 I0 h5 X4 Y
- chown -R $USER:$USER "$INSTPATH"( J4 v9 h$ o- h/ I( e4 A* U
- else6 G- ~' N, j/ I1 n& x
- Log "There was an issue while extracting DBC and Maps!" 1* @/ K8 k7 [% Q3 w. C% Y
- rm -rf "$GAMEPATH/map-extractor"! z+ p4 d, S- G. l, p* l% R1 l' j
- rm -rf "$GAMEPATH/dbc"
; w% _8 K# r0 b4 O/ M - rm -rf "$GAMEPATH/maps"5 S6 i9 v. {2 I# |: R# A
- exit 1& k4 J, O! \+ \' {+ D* l
- fi: V) z8 z2 ^7 @4 a
- fi
( n8 A- p* q+ o" G3 } - fi
% n. ?! T+ b, w0 V, X8 N/ C+ x
) s6 u- J9 x6 E7 l M& A. z2 j- if [[ $ACTIONS == *2* ]]; then5 G u% I* ]0 }: U" r
- if [ -d "$GAMEPATH/vmaps" ]; then
& y9 p0 Y9 o5 n& L# U - $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "VMaps were already generated" \
+ w: Z4 E4 H# {- t7 y8 N - --yesno "Do you want to generate them again?" 8 60. J+ s' Q# v8 i, c5 X% ?* k
; Y o8 Q! u7 X& B9 W: n" S- # Check the user's answer
& J, S! }' O- f& r* x2 U7 g2 P - if [ $? -eq 0 ]; then2 V) L' m# G" E
- Log "Deleting VMaps previously generated." 1% C- P5 O5 T ]4 g3 U8 v5 L. _
- rm -rf $GAMEPATH/vmaps6 v+ S5 e( A* q! a3 L
- Log "Copying VMaps extractor" 0
& k' R0 I/ U; {8 ?' r! w - rm -f "$GAMEPATH/vmap-extractor"0 n! o' k) w, b
- cp "$INSTPATH/bin/tools/vmap-extractor" "$GAMEPATH"
8 b- T2 k) U$ {7 f3 r+ [ - / F: s( G! E9 a' Y; x8 K
- Log "Extracting VMaps" 0$ c e8 `# D5 o0 B' O+ `
- cd $GAMEPATH
& m7 g5 X M/ n) C9 U# m+ R" W' z - # Make sure there is no previous vmaps generation that cause issue.
: v- Q" H& J- N" Q - rm -rf Buildings, y/ o; Q) g2 H7 g& A
- ./vmap-extractor
5 s/ G. n8 T% ?( `
" I4 V( Q7 C. o9 D, ?) {1 R! |! j4 c- if [ $? -eq 0 ]; then3 ^' X( A/ j0 i
- Log "VMaps are extracted" 0" i" O$ J$ I% f' G
- Log "Copying VMaps files to installation directory" 02 f5 |; z+ N+ Q* C" w! @
- cp -R "$GAMEPATH/vmaps" "$INSTPATH/bin"
0 ^6 Y* g: v3 @9 T% f2 f$ { - rm -rf "$GAMEPATH/vmap-extractor"
# X& G4 d* [& z7 r4 \: o3 D: j( H& I - Log "Changing ownership of the extracted directories"$ A% y% P, J/ w* P8 ? ]
- chown -R $USER:$USER "$INSTPATH"1 `5 _: `( P( l! l1 H3 i! t
- else
6 T6 [+ g! K0 W* s - Log "There was an issue while extracting VMaps!" 1
/ N1 G. a0 a; v: W& k - rm -rf "$GAMEPATH/vmap-extractor"
' S% W. Z6 e; W1 g, F - rm -rf "$GAMEPATH/vmaps"
- Z# x" @) P6 ?' |' n% }* a - exit 1
; I3 O0 R: j' {" u5 Z0 o; [0 z - fi
( D2 q' n7 p2 F$ [3 }( k - else* W& ]+ t; t4 G1 W4 s( X
- Log "Copying VMaps files to installation directory" 0
2 e& N; X0 F2 D4 k3 a - cp -R "$GAMEPATH/vmaps" "$INSTPATH/bin"
& [( m" O s3 l2 d4 f3 a - fi- s4 B* T8 j5 {
- else
" s1 ^$ \: L& W - Log "Copying VMaps extractor" 0( Q# k: Z9 f5 I4 e# _! i
- rm -f "$GAMEPATH/vmap-extractor"
( K" ^) U$ b j; H5 z; f; r - cp "$INSTPATH/bin/tools/vmap-extractor" "$GAMEPATH"6 D! s- }( W7 s& a, [' _) {, D
- 9 N( G9 S( H, Y" Z& z$ G, h! c
- Log "Extracting VMaps" 0
) n; N" y# E F - cd $GAMEPATH
, N; D0 n" `2 G; ? - # Make sure there is no previous vmaps generation that cause issue.0 H& d8 y: n: x% R2 T+ h5 L. ~
- rm -rf Buildings$ Y5 z& s5 I, `. s
- ./vmap-extractor& h3 n+ `' t2 ~
6 A% m- V7 J/ ?: y# N4 \4 q" G- if [ $? -eq 0 ]; then" N p" Z2 L3 u2 L; c9 T8 c4 n
- Log "VMaps are extracted" 01 X& P' a/ _: w/ E
- Log "Copying VMaps files to installation directory" 0
]# K9 j0 [7 I( d - cp -R "$GAMEPATH/vmaps" "$INSTPATH/bin"
% ~( g7 t9 R: z' T7 G' W - rm -rf "$GAMEPATH/vmap-extractor"
" l$ G% H- g4 m( D V, w' ]/ w - Log "Changing ownership of the extracted directories"
4 n8 Y& _+ Y7 d2 |2 g: G& ~ - chown -R $USER:$USER "$INSTPATH"* {, s* ~, o- T9 _5 a4 u! ^
- else' x" K8 z. Z+ W: ]9 E7 R
- Log "There was an issue while extracting VMaps!" 1" N( i9 `2 { R K. c
- rm -rf "$GAMEPATH/vmap-extractor"1 G0 {+ h& h ]# Z$ p3 u1 x
- rm -rf "$GAMEPATH/vmaps"* K* `2 i* r& N" S4 E
- exit 1
1 \% J( E* u9 |. M6 H0 L ` - fi
8 {4 i0 R0 R8 I+ k3 q - fi
4 L0 g% U( o; |- H# T% `7 X - fi
4 N' K; _; }, M" V; E - ! Y8 x' f3 X! z. V5 m
- if [[ $ACTIONS == *3* ]]; then
2 Q7 R' S4 i" G" F, u m5 { - if [ ! -d "$GAMEPATH/maps" ]; then7 x7 L9 V9 A$ [) [0 |- M
- Log "Error: maps files must be created to be able to generate MMaps!" 16 L. o8 K- ~2 K( p- j% N
- exit 1/ L( x1 y8 c, z8 i
- fi* ]% A# z+ A* C/ F* E6 k4 n; }$ S3 K
- 8 A$ K( b) z! G- Y; m2 M
- if [ -d "$GAMEPATH/mmaps" ]; then' ~) ~/ u8 D% O2 d
- $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "MMaps were already generated" \
8 B: K. J2 l. E! J' [4 ^ - --yesno "Do you want to generate them again?" 8 60; `( e! c4 c+ l% i
# ~' q( D; u+ `* l, u- # Check the user's answer
$ |* x9 G) H; A: C - if [ $? -eq 0 ]; then
7 q* u; r% |* j/ s9 b: x. m - Log "Deleting MMaps previously generated." 1* {( m# a7 K1 W7 S" U5 F z9 c
- rm -rf $GAMEPATH/mmaps9 J8 q2 _0 J6 D0 t& F
- H8 f' l$ _! h
- Log "Copying MMaps extractor" 0/ G5 w8 i$ q+ U/ n4 k3 r/ u( O3 z" F
- rm -f "$GAMEPATH/MoveMapGen.sh"( g- E! k3 R5 J, M$ h. f E3 E
- cp "$INSTPATH/bin/tools/MoveMapGen.sh" "$GAMEPATH"
) g# E, s' s( {( \7 q - cp "$INSTPATH/bin/tools/offmesh.txt" "$GAMEPATH"
! _& B/ D) g* x+ A2 Z) P$ f- p - cp "$INSTPATH/bin/tools/mmap_excluded.txt" "$GAMEPATH"
$ t0 r' U- a2 n7 {9 s - cp "$INSTPATH/bin/tools/mmap-extractor" "$GAMEPATH"
/ H2 m3 M V1 C& ~' P5 V5 N: { - + f! G0 ]" P' e0 i$ b- K5 i
- CPU=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Please provide the number of CPU to be used to generate MMaps (1-4)" \+ O' [+ f$ z& J: v6 M# p
- --inputbox "Default: 1" 8 80 3>&2 2>&1 1>&3)
7 U* z* w7 r! [ X( O - : u* e0 i: g- i% S! i! t' \- s
- # User cancelled his choice, set default to 1.
% e: x0 y) d1 ?5 U3 x4 \; E! R( d - if [ $? -ne 0 ]; then3 p. Q1 o5 u" k8 |/ S' C
- Log "User selection was cancelled. Max CPU set to 1." 1( L$ C2 D9 f' w* m
- CPU=1. S6 ~6 P( S4 P) [* ~$ l
- fi
/ ?( n# i5 _8 E9 o6 Y. l - : B. }$ _. q: _0 M; k0 a
- if [ -z "$CPU" ]; then
0 f6 Z( o3 H) w - Log "User didn't gave any value. Max CPU set to 1." 1
! V0 J) G, t% |( A8 o; B/ h" P& P - CPU=13 u+ c1 b; `2 `6 i
- fi
+ k1 ~ t, `- o. J7 k9 G- V) D
! y% q2 [* ?+ ]- if [ "$CPU" -lt 1 ] || [ "$CPU" -gt 4 ]; then$ K w9 H) {4 S- S% w7 |1 E
- Log "User entered invalid value. Max CPU set to 1." 1) d, k) S! x( ~% s1 m
- CPU=17 p; |- u, K" c* e% Z$ K
- fi3 Y4 H* p; ?5 O+ p7 H
- 7 B4 k# u5 c' \2 X. c" v0 X% w$ z
- Log "Extracting MMaps" 0
" r% R \ ~/ q( K - cd $GAMEPATH
8 R ^' ]6 T7 y9 p - # Making sure we can execute the script
7 `. P5 A G* X* s [ - chmod 700 MoveMapGen.sh* w& U" h& M) S; F
- ./MoveMapGen.sh $CPU
4 `- U j3 J/ K/ j1 o7 i8 x L
0 j# f: x% s+ K# Q3 N1 ]6 k- if [ $? -eq 0 ]; then6 m y& Y$ q! A3 Z2 s# v( l
- Log "MMaps are extracted" 0
7 b) S M- B- Z$ Q( v - Log "Copying MMaps files to installation directory" 0
9 k S E7 K7 z - cp -R "$GAMEPATH/mmaps" "$INSTPATH/bin" a7 w; b2 g# }1 }/ m! X
- rm -rf "$GAMEPATH/MoveMapGen.sh"8 p- i" g, \$ z+ n
- rm -rf "$GAMEPATH/offmesh.txt"8 [1 f. E) E) z" l" Z" {
- rm -rf "$GAMEPATH/mmap_excluded.txt"' G+ e4 ?1 S4 _5 }+ z3 w
- rm -rf "$GAMEPATH/mmap-extractor"* h0 i: W7 w1 L9 {; Z
- Log "Changing ownership of the extracted directories"" p. E4 N. W1 ^, E r
- chown -R $USER:$USER "$INSTPATH"
: F: T! Q/ z9 [8 b, l- W9 ~ - else+ D3 J" e* d: ?- @! { [/ g% [
- Log "There was an issue while extracting MMaps!" 1
0 x7 Y% s% h3 S; I `- g) z! c4 o: U, t) N - rm -rf "$GAMEPATH/MoveMapGen.sh"
& S9 c) K( Y/ Q6 N& d8 @$ L - rm -rf "$GAMEPATH/mmaps"- C' }; r$ y' }* @4 d
- rm -rf "$GAMEPATH/offmesh.txt"
! [4 h& l2 @& S: e9 s6 W - rm -rf "$GAMEPATH/mmap_excluded.txt"
' Q& p4 x1 ]; t) D6 N2 L - rm -rf "$GAMEPATH/mmap-extractor"/ J' p- Q& g( h+ w
- exit 1
6 f; w% g, t# [0 M* ~& P3 z - fi
* J& k0 w8 e3 w# X$ a4 p - else- D4 O: e2 J" A0 a1 y1 I% `
- Log "Copying MMaps files to installation directory" 0
, q# Z# }+ l, C3 b* `7 f% m - cp -R "$GAMEPATH/mmaps" "$INSTPATH/bin"6 W: }; O$ g; R7 _* b8 F6 x
- fi% C- o, \% H7 `. f0 \
- else/ J. q) i5 i1 u$ X
- Log "Copying MMaps extractor" 0
0 E% x N) W4 T2 F; M& i, F - rm -f "$GAMEPATH/MoveMapGen.sh"
8 J: U/ j- X# c* L. ~. M - cp "$INSTPATH/bin/tools/MoveMapGen.sh" "$GAMEPATH"
+ {* u2 ~$ u5 |4 y* L g% d - cp "$INSTPATH/bin/tools/offmesh.txt" "$GAMEPATH"0 y3 S2 ^0 `4 g* k& w
- cp "$INSTPATH/bin/tools/mmap_excluded.txt" "$GAMEPATH"
1 \) g- @: b1 V# q3 r - cp "$INSTPATH/bin/tools/mmap-extractor" "$GAMEPATH"; X: Y, u/ y: W( O0 c4 [
- CPU=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Please provide the number of CPU to be used to generate MMaps (1-4)" \
! J7 [1 N8 J% \- M5 ~ - --inputbox "Default: 1" 8 80 3>&2 2>&1 1>&3)2 l/ |/ P. W* v6 w! } L3 o
- 7 U6 L* n9 w) ?& A/ d
- # User cancelled his choice, set default to 1.
C2 W; @% C5 O. ~/ Q" U - if [ $? -ne 0 ]; then
. c: i7 N3 v) J& e4 {8 i* V - Log "User selection was cancelled. Max CPU set to 1." 1
$ o4 F8 b7 F8 V2 H# `* r - CPU=1
" ~9 y }; u' O& c- {( o. Q$ \ - fi0 o; W1 N2 e, ~7 u+ s2 S
- ' {- I9 I' Z' u
- if [ -z "$CPU" ]; then
) ^1 b1 N' N+ Z6 x3 e - Log "User didn't gave any value. Max CPU set to 1." 1, q* U) W0 r$ x
- CPU=1
) X2 T$ ^9 w- w9 V* k - fi; g1 y/ P$ |- l& C- U( c/ b8 l% u: t
- 9 F3 U0 ]% X& q% y# L0 S
- if [ "$CPU" -lt 1 ] || [ "$CPU" -gt 4 ]; then
5 ~0 X1 {. ~& E9 ~: N! X- u+ B) E - Log "User entered invalid value. Max CPU set to 1." 16 \) ^$ J2 [% E" A4 |, P( l# R! R0 t
- CPU=1
; i- S, h; P5 Y6 A2 E2 d - fi
; i3 W' D" K# u/ K# ?8 J, \4 A - * o) s1 v9 W! O2 p! f; L
- Log "Extracting MMaps" 0( k) Q% O; r) I* v# e" G
- cd $GAMEPATH
' U9 \! [, Q; i - # Making sure we can execute the script7 i* t- i& C/ r8 F( L% {+ X. V2 `, I
- chmod 700 MoveMapGen.sh
) w& C; Z% f- r% f( m7 { - ./MoveMapGen.sh $CPU
. J* J6 \. K' S0 Q - 7 o# q7 x N, U
- if [ $? -eq 0 ]; then3 n: K) c8 m% s- m! e
- Log "MMaps are extracted" 0
( T5 G$ D1 s3 D) u, T2 d) l2 \ - Log "Copying MMaps files to installation directory" 0
3 x! W2 z. D( f! K7 R; B% h - cp -R "$GAMEPATH/mmaps" "$INSTPATH/bin"* f! V% a+ W7 J; j5 [
- rm -rf "$GAMEPATH/MoveMapGen.sh"+ T& B) Y, O- s/ u% e
- rm -rf "$GAMEPATH/offmesh.txt"
3 l/ {7 |) V3 t5 _" {, [/ V; _ - rm -rf "$GAMEPATH/mmap_excluded.txt"
) {+ W7 n, c h# b( q j - rm -rf "$GAMEPATH/mmap-extractor"/ B2 z( w4 k! c1 g' I3 t) U
- Log "Changing ownership of the extracted directories"
3 m; F( Q! C# h/ Y8 E - chown -R $USER:$USER "$INSTPATH"/ m. C) \' L7 r( d5 ^& m
- else0 D+ C$ d, O& z# M8 g) K
- Log "There was an issue while extracting MMaps!" 1
; R- X! T. H* \ - rm -rf "$GAMEPATH/MoveMapGen.sh"
) t6 `# a( c; s - rm -rf "$GAMEPATH/mmaps"4 r0 b3 S5 G% [' L
- rm -rf "$GAMEPATH/offmesh.txt"
* k" }7 {5 q. v P' G8 m( u9 d - rm -rf "$GAMEPATH/mmap_excluded.txt"
+ U6 |, b3 w2 x- \ - rm -rf "$GAMEPATH/mmap-extractor"8 ^6 n* `7 A* Z" e5 @/ @6 Z1 ]6 I. N
- exit 1% b2 W5 V) L$ F- i7 k
- fi4 W7 Z' \+ n( R9 \, j/ u& }) o- Y) u
- fi% L$ v3 S3 t4 h: t( m
- fi' \! [% \* S) r- x! e
- }3 I. }% ~! t- f3 l0 G
1 F; P0 C" D8 b0 V# V% b( E- # Function to create a Code::Blocks project% H) \3 C% Z! j- Z8 ~
- function CreateCBProject+ q8 R1 r6 E4 ^1 |% u; b
- {
1 {$ D* j$ f6 D - # Create the dircetory if it does not exist* {) ~- f. Q5 v0 l4 `$ n# I7 [
- if [ ! -d $SRCPATH/server/linux ]; then* _- Q7 h3 ~ e! w: m# Z
- mkdir $SRCPATH/server/linux
' n' ^) f$ W% `7 @" b5 ^" L$ L+ y - fi
; x! t& b: ^, ]7 M - 1 d; c3 b- }* e, x# Z
- # Now create the C::B project
7 m; \, N) Q. y% M% F' _ - cd $SRCPATH/server/linux
$ `4 W; G2 c/ X+ E: d! u* {5 A( ^ - # make sure we are using the cmake3
$ _/ d# e$ W) [6 v$ g& V$ @ X8 C! a - UseCmake3
7 W8 I7 e4 d' e8 J - $CMAKE_CMD .. -G "CodeBlocks - Unix Makefiles"
/ e2 _$ c3 J. _. I D% k. m - }+ I/ L* f& I1 k- u$ Y+ v) r4 O
- # o" ?+ s: w* K% } s" s
- 4 K& ]2 W, S: w& H
- 9 w% b2 `% D, [5 H' X
- # Prepare the log
, F, ?. p$ U% e3 D8 _ - Log "+------------------------------------------------------------------------------+" 0. v, x8 K k7 u- n
- Log "| MaNGOS Configuration Script |" 0
- Z# W+ Y. ^6 o; } Q - Log "| Written By: Ryan Ashley |" 0) F% ?/ [: C* ~- I$ U; B
- Log "| Updated By: Cedric Servais |" 0
+ m" V8 @# \9 H - Log "+------------------------------------------------------------------------------+" 0
3 d) b" x9 T3 F' J
' {5 u2 F+ i/ N' w- [* J6 O- # Check if user who is running this is root3 [0 N$ F5 w: N( c0 o
- CheckRoot$ c0 n' E- r- V Z$ ?) Z% ^9 A( y
; c$ o& m4 a9 ^4 F- # Select which dialog to use
$ A2 N7 y3 D- M9 c6 L- r - UseDialog: ^3 ~/ |! j* @7 v
" s, U8 k3 r+ z' _8 G/ [, O1 G, @- # Select which activities to do( m( B* |/ P5 U( q, H
- TASKS=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Select Tasks" \4 G X) v& m1 `1 C" m
- --checklist "Please select the tasks to perform" 0 70 8 \
# D0 t! |$ j3 u1 L/ m: s$ X! M& Z - 1 "Install Prerequisites" On \- s; U' v* ]9 s8 m, c4 [0 X
- 2 "Set Download And Install Paths" On \
\0 `/ y7 @1 ?- y7 h9 g - 3 "Clone Source Repositories" On \9 d4 P7 p7 T& H( H, U" @
- 4 "Build MaNGOS" On \2 h" Q4 B' }+ S/ M8 `6 G3 }$ ]
- 5 "Install MaNGOS" On \
; M6 H( q# |" P3 s$ X# c" c - 6 "Install Databases" On \
2 p, Q2 O6 b8 o$ V! \! [ - 7 "Extract Resources" On \ M/ w2 W* q6 F) w3 p
- 8 "Create Code::Blocks Project File" Off \9 P( I9 x2 q4 m4 ? c) z& H5 k
- 3>&2 2>&1 1>&3)
) Y# R- @+ s6 g& U. O1 v - : [9 J! O5 l; Q, F* h% ~4 r
- # Verify that the options were selected. _: H, d- `' G' ]9 S
- if [ $? -ne 0 ]; then
3 |$ d) w1 @, x5 c3 L) i& U. Z - Log "All operations cancelled. Exiting." 1
5 T0 ?( M. o( {7 O+ X; } - exit 04 n: ^5 H! {( u- I
- fi. E0 J) o) A5 i1 @3 L; X
/ |& A x- c1 \: g5 u- # Install prerequisites?7 t8 m6 ]/ Z' C% [" O7 m3 c
- if [[ $TASKS == *1* ]]; then! N6 D8 D9 \8 j% Y
- GetPrerequisites* P5 |3 G" {. A Q& z: Y9 |
- fi! G |, q2 [/ i; r, _
2 q8 V5 b' Y" X- # Select release and set paths?2 C L( e; B* E8 k
- if [[ $TASKS == *2* ]] || [[ $TASKS == *3* ]] || [[ $TASKS == *4* ]] || [[ $TASKS == *5* ]] || [[ $TASKS == *7* ]]; then% }/ o5 p0 g# x: q" m% j
- GetUser7 B) g8 K2 {' s3 ]
- GetRelease
" Z1 a1 o$ E6 ?3 B6 L - fi3 B: p7 O/ d. M* D7 b
4 T# X% a, z; A- if [[ $TASKS == *2* ]] || [[ $TASKS == *3* ]] || [[ $TASKS == *4* ]] || [[ $TASKS == *5* ]] || [[ $TASKS == *6* ]] || [[ $TASKS == *7* ]]; then/ Y, T% P9 [! t1 v, w9 q0 M
- GetPaths
. ]! z! q1 l- l$ J2 a - fi, Q. r0 Q2 j8 ~8 C/ E6 S/ z, T( o
! c6 y) q8 F: O$ Z% ]- # Clone repos?
" D! a% x) U3 \/ ~+ T0 E1 @ - if [[ $TASKS == *3* ]]; then
4 H/ R5 f$ b) l" { - GetMangos: L' z7 h1 M$ ~$ D. p( s0 e
- fi/ J9 S7 q n! L! \8 i1 T. }6 [0 e
- + d/ Z; N' N) H
- # Build MaNGOS?0 N8 U( {! d9 b# f; m
- if [[ $TASKS == *4* ]]; then
) v3 z+ L5 x9 V3 Z# n - GetBuildOptions
2 Q" K. Y; ~* n( a, o+ l1 Z - BuildMaNGOS0 M2 X( @5 e% U
- fi& M, G6 t5 A/ J8 S1 I$ y0 |% r; b
" Q7 j7 p! D% p6 H/ t2 v8 C- # Install MaNGOS?
6 p; E$ E2 ^2 s6 r - if [[ $TASKS == *5* ]]; then8 _7 f x* v% R
- InstallMaNGOS# i- @. B( q! \
- fi7 a) R) ]3 Y* Q# a/ F; M [% p
' u5 v7 \5 |% F2 b7 M6 |- # Install databases?
2 [/ q$ ?/ ]' O" ]( a - if [[ $TASKS == *6* ]]; then
$ m& w! S0 Q) _/ S$ k3 B# _ - HandleDatabases
/ ~0 z* R) o) \* v* K2 v - fi
( U9 L; b" h% s0 O6 u) H/ S
% B* B: p/ e' u4 u, [. X- # Extract resources from the game?0 u8 v. q/ P/ J, Z! i j7 s
- if [[ $TASKS == *7* ]]; then. p8 l7 R2 U/ Y+ L) \% ^; b. T
- ExtractResources' G7 H } @/ d# D
- fi
8 ], ?7 D& y4 A1 O" r - + | B( d* C9 S& C e( X* {
- # Create C::B project?
! b) v6 X# W1 e& D( x - if [[ $TASKS == *8* ]]; then
- S# j$ R' N3 c4 c f - CreateCBProject
0 Q. D% e$ i6 N% [& W- E( V - fi- k/ F# g7 k. e1 C$ a' Y9 l3 f$ r1 u
8 m9 ]* }$ [/ m5 n3 ?- # If one of these actions has been performed, then we know the user.
% _5 ~" Y: |+ ]2 K; x/ C - if [[ $TASKS == *2* ]] || [[ $TASKS == *3* ]] || [[ $TASKS == *4* ]] || [[ $TASKS == *5* ]] || [[ $TASKS == *7* ]]; then
5 r+ Q8 S: L4 T% p - Log "Changing ownership of the extracted directories" 11 R, m" p# f6 ]$ T' T
- chown -R $USER:$USER "$INSTPATH"
$ s. ~( O k9 h: R2 M - fi
. u |/ E: Y Z# F - 9 S' r9 n6 M( o& b2 u/ A( P
- # Display the end message8 \4 z% s6 v3 h6 S, F$ c' ~
- echo
7 D9 k8 X0 Z2 |& {6 q/ D7 c. ` - echo "================================================================================"3 h) ?( s) T% }" z% E `
- echo "The selected tasks have been completed. If you built or installed Mangos, please"
. S" X# O0 T% {3 P7 Y# T: k - echo "edit your configuration files to use the database you configured for your MaNGOS"1 L, a. p: x4 Z4 Z' C1 j$ s
- echo "server. If you have not configured your databases yet, please do so before"
4 V! P( X9 M2 s' P) E4 } - echo "starting your server for the first time."; Q* [% [ e0 ~1 A+ Q
- echo "================================================================================"9 G7 I# K) R% }3 m4 v" c+ `
- exit 0
复制代码- wget -c https://raw.githubusercontent.com/mangostwo/database/master/InstallDatabases.sh && bash InstallDatabases.sh
复制代码- #!/bin/sh
* b, Y- p, C& e) K - ##############################################################################/ K# @6 h/ K* V a+ t) `" D
- # This utility assist you in setting up your mangos database. #) O7 T; O# Z Y/ v
- # This is a port of InstallDatabases.bat written by Antz for Windows #" O8 u# z5 g' `7 F$ G6 ~: t
- # #0 g7 ?4 |! Y# ?0 o
- ##############################################################################
* z, e- R, y4 g3 K. ~* _+ T
8 G$ Q+ k1 }8 ~ ? U! o! J7 i- OLDRELEASE="Rel21"* {( `) v# n3 @! L4 q ]( L& t6 H
- RELEASE="Rel22"
9 ?3 b ~# t* j% Z* x) u - DUMP="NO": m( t: v" Y6 z2 V$ l* W5 C
- $ X H" @2 F$ P: Y+ {
- dbname=""
$ i, X8 \2 P9 u - dbcommand=""
8 F% q! s; E3 b% Y0 P - 5 A' T, K- I9 x
- createcharDB="YES"3 `. w& u# ^9 X2 J# {
- createworldDB="YES"& n/ k* ^9 s' o
- createrealmDB="YES"6 \4 c3 E7 V1 p. x
( P ?' ]5 l1 t2 l4 ]3 F- loadcharDB="YES"
3 J7 t1 C$ |9 r/ ], G* n) f - loadworldDB="YES"
0 b2 m+ |: Z$ l1 h - loadrealmDB="YES"1 H8 v0 U. c8 [+ J9 E
- dbType="POPULATED"* X) t& T4 z7 d
- 0 l8 l& \- T* Q5 v
- updatecharDB="YES"# F# a+ E# i' J: u
- updateworldDB="YES"
^# Q& l$ O! M - updaterealmDB="YES"
9 D. w, C8 s0 K% ?) }* v) \) w4 H( R% ` - 8 A* J H/ \/ J: v# u# [
- addRealmList="YES"$ Z3 u( G0 H! d. o4 u
7 p9 |9 p0 D* B) P/ ] ~7 }- svr_def="localhost"7 M3 w3 i8 N9 P9 ~' \
- user_def="mangos"* f1 i* J/ J) Q5 q' n- z5 a3 e% }
- pass_def="mangos"
$ S0 U' H# K9 P - port_def="3306"7 g: E6 K% {' x8 f( J; n0 l
- wdb_def="mangos2"
* @' i# C, _6 G w! Q6 `* N - cdb_def="character2"8 H, k; i- z# c" A( ~/ j, M! m
- rdb_def="realmd") g* l i1 H% r
- 5 d4 U, t: k" y, i" J7 f
- printHelp(): Y3 R4 n- N5 J% I: ?$ H% X
- {
% c; J# Y2 z3 G0 K - printf "Usage: $0 [-s] [-u] [-d] [-h]\n"
" T: ?% z, j/ P' L - printf "\t-s: Run this script in silent mode, only prompt for the database information\n"; {7 a3 o5 P. ~: |
- printf "\t-u: Run only the updates of the database\n"6 R/ |% p9 s& i7 |2 m
- printf "\t-d: Dump the database configuration into the home directory of the user\n"
1 J9 X: n# W, @9 {# }' W5 k - printf "\t-h: Display this help\n"! i* Z: n! P2 q, Q1 U L
- }. h4 B) \2 R. O
- 4 q8 E" j2 @, ?3 }" z
- printBanner()
% y% _: h1 a! j4 g - {
) k. X1 V0 t( J+ A - clear
. a7 j; w! [* L) [: l" x1 Q) h9 Z - printf " # # # # # ### ### #### \n"! [4 d+ B$ V# P# l9 h! n% M9 `! k1 J
- printf " ## ## # # ## # # # # # \n"& m5 R+ ~1 f: C, K3 _. T: N
- printf " # # # # # # # # # # ### # # ### \n"
4 a% p8 |, N1 g5 k) O! L - printf " # # # ####### # ## # # # # # \n": z/ N2 T* Y3 n& w% G
- printf " # # # # # # ### ### #### \n"
0 {5 N: ~, ]" V& C( X - printf "\n"$ ^' p' U9 D+ i8 l- o1 D! k
- printf " Database Setup and World Loader v0.03 \n"
8 }* j6 J* J" W - printf " ---------------------------------------------- \n"
6 E! m8 P- d; ~& ?9 N! U9 h, ? - printf " Website / Forum / Wiki : https://getmangos.eu \n"
0 @- h& ~4 ^- K2 e8 D - printf " ---------------------------------------------- \n"
" t. B3 y* ~; S) E$ V Q - printf "\n"
. h: w! M, \) G& ^' ?: ?4 ^ - printf "\n"
9 N& h+ t$ T9 R& d' }) i @( F - }# A, [% A& n" W
) q3 k" K8 T9 ~* L- printActivities()+ h; o2 k% J) J% a5 d4 k5 r3 j
- {
1 r! V; ^/ M# {: o5 R - printf "\tCharacter Database : \tV - Toggle Create DB (${createcharDB}) \n"! O# D( q. }6 w+ P1 L1 G* l/ C. ~+ Z# \
- printf "\t\t\t\tC - Toggle Create Structure (${loadcharDB}) \n"
! B6 b) P5 H0 S - printf "\t\t\t\tB - Apply Character DB updates (${updatecharDB})\n"$ c! g2 y1 m; {4 E7 G% k
- printf "\n") p0 ~7 z- D6 [: ^
- printf "\t World Database : \tE - Toggle Create DB (${createworldDB}) \n"% u2 B* P% X5 v! L5 i4 O$ E& ?: V$ P
- printf "\t\t\t\tW - Toggle Create Structure (${loadworldDB}) \n"
; g8 R' ~3 c8 j9 e; o: | K. Z - if [ "${loadworldDB}" = "YES" ]; then4 z' `0 ^$ z# L H p ?6 a
- printf "\t\t\t\tD - Toggle World Type (${dbType})\n"
- y" |% `+ y( F" M" D, t - fi( F3 }- J# d5 q+ \
- printf "\t\t\t\tU - Apply World DB updates (${updateworldDB})\n"
6 G7 s* e! q+ m O3 i$ d - printf "\n"
$ W3 Y- G, l) Q# P4 {" e8 Q7 c - printf "\t Realm Database : \tT - Toggle Create DB (${createrealmDB})\n"
% r: N6 {* g/ {$ S( k8 a - printf "\t\t\t\tR - Toggle Create Structure (${loadrealmDB})\n"7 k) [' J1 Q+ j
- printf "\t\t\t\tY - Apply Realm DB updates (${updaterealmDB})\n"
# O; P, F! }" [" B - printf "\t\t\t\tL - Toggle Add RealmList Entry (${addRealmList})\n" ( H% {& @4 _) o5 ~; z. _- T: B% u
- printf "\n"
& ?, o& V2 N+ `7 G$ e - printf "\t\t\t\tN - Next Step\n"
4 F$ @( C F4 F' I* a+ r - printf "\t\t\t\tX - Exit\n"
3 U% U6 N* r7 s - }/ H1 G# n. j- U! y* p- v& _7 c
- 5 i! m$ n2 W, J7 h, [
- determineDBName()! P% @5 i" r( F& F0 g# z, m
- {
4 K# Y% k P" G# a! e& {$ u - if [ $(which mariadb) ]; then
" p1 ~- Y Y0 ^- [9 C - printf "MariaDB found.\n"
: k0 o6 O8 z9 O; U" p - dbname="MariaDB"
2 K6 D2 Z% P2 h/ K* S - elif [ $(which mysql) ]; then
9 y, x5 Y/ G4 e! O9 k - printf "MySQL found.\n") J, m1 U' o( n. y: ~7 \# F
- dbname="MySQL"( ^% D" e& Z5 ~$ u1 i( u% x
- else
' `, J* P5 m; J7 z/ d - printf "Did not find mariadb or mysql.\n"" H5 C- f! U1 T( n6 R, e+ Y, k+ R
- fi
6 i! X7 p- x( U - }
% b& f7 I: O% G* N( _8 X1 d& p - . j: k7 _# O* t @& m# j- g: F
- mysqlconfigeditor()6 g* ]6 v( J9 b
- {
( }: w: d& y0 R" ^8 v - dbconfig="mysql_config_editor set --login-path=local --host=${svr} --port=${port} --user=${user} --password --skip-warn"1 A8 B& P, f& c& {4 i7 @6 D
- }
, q6 U4 @9 Y j: ? - 7 Z5 A* j! k5 k1 x' ^" w
- determineDBCommand()
, D. x# k9 w3 `* t - {- X8 `0 H/ a% Q. C; P0 J0 }2 K
- if [ $dbname = "MariaDB" ]; then' I4 A; \$ p# q, q; d% e
- dbcommand="mariadb -h ${svr} -u ${user} -p${pass} -q -s"
, K+ p& R c# T' ?0 M. E - elif [ $dbname = "MySQL" ]; then, o8 z; j- g9 p6 Q4 H3 l
- dbcommand="mysql --login-path=local -q -s"
6 x9 ^8 d8 h# i. h - else2 `) @, n9 f' m
- printf "Did not find mariadb or mysql.\n"
; t3 }$ D9 ^8 e4 E+ t9 p# X - fi
3 q( }1 ~( | y" Q2 K - }
- D! F T0 w% y* ]3 R - 7 L- R4 A4 X. d- O0 |6 l
- createCharDB()0 |5 J9 F# t/ n* v6 u2 K! p
- {
- t+ }+ ]- C. k! @ - printf "Creating Character database ${cdb}\n") Z P; ~- L+ U+ ?; s& H. U
- $(${dbcommand} -e "Create database ${cdb}")
) F8 b- j0 M2 F/ |+ @ - / B; m$ C& M8 @' S0 I5 V
- if [ "${loadcharDB}" = "YES" ]; then
1 R1 D* _3 g5 v - loadCharDB
* I7 D6 [' O. D5 N& j3 `1 r - fi: Z) `: J: l- [( U- X0 ^5 Q
- }# X/ K: ^# G* m7 k8 q4 m
5 n3 v/ j6 S6 n4 g7 J/ d- loadCharDB()
# f3 O1 D! |, }9 i - {
+ h3 T7 T0 y; W! ` c& | - printf "Loading data into character database ${cdb}\n"1 I% w$ k, [3 v7 P3 b
- $(${dbcommand} ${cdb} < Character/Setup/characterLoadDB.sql)# @: q5 t9 O& K- m2 }! \
o( r0 t e7 p0 t+ T7 {- g0 l2 ^- if [ "${updatecharDB}" = "YES" ]; then9 t" ]* n/ v. P# F
- updateCharDB
! ]2 O+ e- D, m+ d" c - fi* C6 w* ^- H9 k
- }+ Q) ^+ C% T' | i' b
- 3 f+ E0 K/ }, R$ f
- updateCharDB()
3 I7 e( }. \" m2 X' S- s - {
v( c% \8 A* l - printf "Updating data into the character database ${cdb}\n"- X: [* `$ e* H6 L" `$ I
- for file in $(ls Character/Updates/${OLDRELEASE}/*.sql | tr ' ' '|' | tr '\n' ' ')
2 G0 J# L7 ~! c! S/ X2 A2 r2 P: |2 j6 X - do
% s1 J( A, V7 O! _, ?9 ? - file=$(echo ${file} | tr '|' ' '), f7 e m* `: U9 @9 x9 T
- printf "Applying update ${file}\n"+ Q, ?, h7 B6 g; b: N4 Y, ]
- ${dbcommand} "${cdb}" < "${file}"& B$ A+ q* u2 V" ~. K- F$ i3 V
- printf "File ${file} imported\n"2 f: X( a6 U6 [
- done2 }8 S5 d4 M+ c9 K+ b( q; M: h
- # H' J8 M: |) Q+ X& P- V
- for file in $(ls Character/Updates/${RELEASE}/*.sql | tr ' ' '|' | tr '\n' ' ')$ {+ }) e; S B- p8 C$ D% E! H
- do- C4 y/ F) N* Q' |& q2 Z
- file=$(echo ${file} | tr '|' ' ')) C( j1 R) Z& n6 v6 C q
- printf "Applying update ${file}\n"0 S" P( ` K" x* H
- ${dbcommand} "${cdb}" < "${file}"
+ w. A2 k& |+ h$ j( m# _ - printf "File ${file} imported\n"/ |7 Z9 T" J7 s+ x( F F: [. |
- done& \8 S0 d) ]; E$ o7 I8 O ]8 R2 j/ c8 A
- }
! @- c: S& F+ Z2 A M
8 p* t# C% t) g( m" s- createWorldDB()
1 Y$ f# Z x0 L - {
0 {4 |$ S3 C+ _6 x& z- _ - printf "Creating World database ${wdb}\n"
3 U7 W% ?! `& h8 f8 E - $(${dbcommand} -e "Create database ${wdb}")
" h( E3 u) V8 M/ U& y - ' }- N+ L6 Z2 D9 m3 T( e6 d
- if [ "${loadworldDB}" = "YES" ]; then s8 @( m2 P, K9 H7 V0 J
- loadWorldDB
" A/ H, r P" ]8 d9 o - fi: J$ S( U/ B8 p8 p
- }
- E, W$ V! a ?
' I. o+ [+ Y; j {6 U% M1 h- loadWorldDB()
: i! v2 [" A2 `) B" t% [ - {0 B+ F* U1 p: j, v, s) y2 i/ [
- printf "Loading data into world database ${wdb}\n"6 v0 \( U) C# J: k- m
- $(${dbcommand} ${wdb} < World/Setup/mangosdLoadDB.sql)
' O2 z3 i9 M ?# U. y/ x
" S/ t5 d9 s L; N" `! g- if [ "${dbType}" = "POPULATED" ]; then+ l& y. a2 w: }9 L
- populateWorldDB
* x8 e1 S x" z) x% ^! `& V+ K - fi6 z. m0 k& O/ ]& ^/ @3 ]
- }
7 P2 D( B* L2 T( c - 9 O! J9 x1 f; a
- populateWorldDB()$ \: N3 A$ R2 ]' i" }
- {
5 m& u# U6 Y, [( [) N- e' ^8 h - printf "Importing World database ${wdb}\n", J3 T2 A/ T( T* L, h
- for file in $(ls World/Setup/FullDB/${OLDRELEASE}/*.sql | tr ' ' '|' | tr '\n' ' ') . Z# f1 ?8 h7 @1 W) k% P/ \/ F: ]
- do9 i" g" x' D% O# P
- file=$(echo ${file} | tr '|' ' ')6 J C2 f" i! m& [5 ]. l
- printf "Importing file ${file}\n"' h# s# G( O% F, Y k7 \7 ^
- $(${dbcommand} ${wdb} < ${file})3 f7 p" Y; b; }
- printf "File ${file} imported\n"7 _1 G1 g# S Y0 e+ Z
- done+ ~8 y1 C- }% l. s3 Q8 x8 ^ G
$ A7 n5 S( z6 ~$ e g) `* B- }* _8 L, T- for file in $(ls World/Setup/FullDB/*.sql | tr ' ' '|' | tr '\n' ' ') ( j" _+ ^4 m v
- do
9 k4 p# f( J+ Z$ i8 d* ] - file=$(echo ${file} | tr '|' ' ')
: }3 [6 @4 D- @7 Y3 I; u' t - printf "Importing file ${file}\n"
7 Q; X5 [$ J+ p6 W/ X+ o - $(${dbcommand} ${wdb} < ${file})4 x" x" R: m3 z8 }; r- }0 m
- printf "File ${file} imported\n"
! \. U' Q# A0 B# i - done
! ~$ l+ G9 B& w - }% b$ v6 j3 \, Z$ \
+ o, `8 a' \$ b1 b6 s& j- updateWorldDB()
7 D z' e1 g& W - {' k+ o- H3 c8 j( I; e
- printf "Updating data into the World database ${wdb}\n"
6 q# A+ @& z. Z" H' i - for file in World/Updates/${OLDRELEASE}/*.sql" n( w2 @/ r% E: f
- do
8 A2 H+ s3 V8 ` e - printf "Applying update ${file}\n"5 K/ k6 R% A6 ?) q+ y4 i
- ${dbcommand} "${wdb}" < "${file}"
/ m- y2 o+ Z' e - printf "File ${file} imported\n"
: \ b2 E5 H; k( l* o7 | - done
4 l% q- A$ c& W0 q' T' |1 @4 D7 M - / [# h5 F& V" ?7 ]+ T
- for file in World/Updates/${RELEASE}/*.sql9 Q' S( T. n) V* [. B8 p1 m* j
- do$ V* S* r( S/ p) D+ m8 h
- printf "Applying update ${file}\n". `! n9 d4 a/ K- B" x; ~8 w4 R3 W
- ${dbcommand} "${wdb}" < "${file}"
, G0 W. N& R I5 g6 I! k! E - printf "File ${file} imported\n"; T9 r- {6 E+ t# ~
- done
) p& ]6 F& E. ?7 v( ^2 { - }: ]; A1 k1 V7 ?; H
- e+ @9 y; t4 y/ o4 z: z6 E/ H% C- createRealmDB()1 h8 V, r5 J4 P8 l
- {
+ ~) i: _" R5 T, }5 T `' \ - printf "Creating realm database ${rdb}\n"
5 Z1 x8 h. H' W4 X! \6 s2 I, i - $(${dbcommand} -e "Create database ${rdb}")
; z, }5 I P0 L- ^7 o9 \$ L
* ^3 y ?+ M. Q, x' H- if [ "${loadrealmDB}" = "YES" ]; then
% g0 d$ k7 {# ^0 j: n - loadRealmDB
8 R7 \5 M7 }3 G" S - fi
5 j& t) D9 n, k! A& o6 u - }' s; o% P% ?8 k# ]1 f! U+ s* l8 q; ^
8 B, a" |. Z7 z) f( W$ o- loadRealmDB()
' S0 r" ~5 q2 D) j' r' x - {5 z1 y( r9 S: X, L1 t4 u
- printf "Loading data into realm database ${rdb}\n" ) H) G/ i/ d/ H$ K
- $(${dbcommand} ${rdb} < Realm/Setup/realmdLoadDB.sql)9 I0 D' j" i2 v- h$ ?, M# [
- }1 Z# e4 D) O2 e5 L8 Q5 z1 [ R" p( p
9 U& c! _ O+ X0 F- updateRealmDB()# r" x# e/ p! C) H) Y8 o9 F
- {
3 H" Q0 c" G2 |! d1 _ - printf "Updating data into the Realm database ${rdb}\n"
# Z: N. Z7 Z5 ]0 ~/ Y% O - for file in $(ls Realm/Updates/${OLDRELEASE}/*.sql | tr ' ' '|' | tr '\n' ' ')$ e/ N# G+ x; z4 ^" F
- do/ ^8 l& Y2 k6 u" }) F" R3 E C
- file=$(echo ${file} | tr '|' ' ')( K& y8 A" ~1 r* @
- printf "Applying update ${file}\n"1 k; L4 g% e8 L, e' K
- $(${dbcommand} ${rdb} < ${file})5 W7 M% ]7 l) d5 _) j
- printf "File ${file} imported\n". u1 S! G! i8 |; \4 K
- done1 h: b8 q. z" ^3 |! i* |' @% a4 Q1 u
- 5 b7 M6 k* Q: a# v3 j
- for file in $(ls Realm/Updates/${RELEASE}/*.sql | tr ' ' '|' | tr '\n' ' ')2 o9 q: i- p/ `( ^3 i% n- p
- do
4 A* ^' I( k: T3 a$ c: O0 w% Y - file=$(echo ${file} | tr '|' ' ')- h+ D3 J: n9 n v0 V
- printf "Applying update ${file}\n"+ u4 h s. U5 B% b0 ~* t4 ~# e
- $(${dbcommand} ${rdb} < ${file})
6 v/ Y# y1 J: } - printf "File ${file} imported\n"
6 e, P1 F* B5 V. k" C2 n) x - done
8 m$ N; v4 l: Y' R2 x) `% Z - }' V% [- P) u8 Y
2 a7 b, k; F0 b3 L6 q0 C- addRealmList()
: D7 _1 O3 [; p6 }, ~" a T( Q9 H - {
) }4 `. {4 ]8 y& A& B% W - printf "Adding realm list entries\n"/ n. J" C3 [4 p9 J j( O+ E) |+ w
- $(${dbcommand} ${rdb} < Tools/updateRealm.sql)- X$ [0 }0 v s/ ` s8 W
- }4 N! A+ G: y) t, N( {. N% Z# v' b
2 W/ x0 k# A% r' n3 s1 C; d' L+ J- activity=""
0 L9 L% ~7 K! K: j
( R8 A: t, f8 a5 @7 u: g- while getopts "suh" o; do
7 X4 R. a- }0 T3 { - case "${o}" in
6 j6 q& i" I+ h. u - s)
) n) M% V% y, o2 W0 c - activity="N"
1 N; X: m0 c2 k. K0 A6 j2 F - printf "You selected silent mode\n"
& A+ I: }7 r, g y; ^" @, U - ;;
4 u1 R4 _' A# O - u)
4 K7 h% k; j+ c9 v4 G7 K+ T - createcharDB="NO"
9 [. u# I4 }2 A, y. G1 l - createworldDB="NO"5 ?; M N% f$ c- H/ K: K7 I
- createrealmDB="NO"' z7 D k* x8 F) D( t! I( A' |7 s
" H5 T6 E+ d. x5 t. x6 `- loadcharDB="NO"
. Y2 A3 B: e. M/ H' P - loadworldDB="NO"
) D1 D8 {5 L2 v4 R7 | - loadrealmDB="NO"2 A) D3 G" Y& s4 Z" O4 \) I. `* ~+ S
- dbType="EMPTY"1 k% z$ w5 J6 N9 k6 P% l, M; A. g& T
- printf "You selected update only\n"5 p9 o; {! S7 T7 j' ?
- ;;+ e* A3 Z' D3 t" V6 j7 r
- d)) X6 D D6 K9 ]# a8 ] X
- DUMP="YES"( ^2 H7 f$ U; l" F7 v- O, N
- ;;
) Z% I: E0 L; | Q W - h)
$ }; U: B1 f$ E- J* i - printHelp
% R) u7 D. z9 x) n - exit 0+ G _6 R' E$ h+ ]
- ;;, v8 S6 P4 I+ H: e# }4 }
- esac
2 A' |; p) \: ?2 ]) o - done
; ~5 s9 v6 s9 C, K
# K, O, v( Z2 A% Y! M. y- while [ -z "${activity}" ] || [ "${activity}" != "N" ]+ [, `! C. K O: t5 F) W
- do
, Z9 S9 |7 @- a9 O% X - printBanner; O& t, l" L0 ^) }9 D7 i* Z1 c, L
- printActivities* A3 q7 E, o+ Y( }" G
- printf "Please select an activity : "
+ p, {3 h9 _" P - read activity
' C3 C- }7 a% U - activity=$(echo ${activity} | tr '[:lower:]' '[:upper:]' )+ @+ V, f) ~2 l# K7 r1 n3 ?! i4 M
- case ${activity} in+ e: r8 G& J1 K: g+ n K6 M7 l, n3 w: O
- "V")
5 ~8 }" T: _' z - if [ "${createcharDB}" = "YES" ]; then3 q3 M1 k: ?) i/ \
- createcharDB="NO"
p1 X' n( U! |6 H( y2 E - else
\$ L9 t% g, j8 a - createcharDB="YES"
T4 q% D- H. `0 W' E$ R/ j - fi) b# S9 u4 H7 I, m; p* K4 V* x e6 o
- ;;
4 c9 d/ W, Q7 [3 N5 O. ?9 y0 h - "C")
3 s2 `% s: t0 ?- K2 O: ? - if [ "${loadcharDB}" = "YES" ]; then
1 e3 C3 q( C& v - loadcharDB="NO"
2 d8 _6 A; C8 K# L# z. h - else
7 ? |+ H( E) Y' A6 M4 u/ b- q6 A1 n - loadcharDB="YES"5 @, j% {$ b0 b5 z/ `0 l
- fi$ d3 D' K& a, k& r- ]6 R% y
- ;;; c# q8 P. _( r+ {! p
- "B")
- I' P2 S7 D: L - if [ "${updatecharDB}" = "YES" ]; then
+ E }5 b3 Y c- a0 m - updatecharDB="NO"" u: j0 U2 S9 O q; C+ S! T' Q# k! x
- else
2 _9 n# W/ \4 ?. H. d2 S - updatecharDB="YES"
% @+ s: z3 [0 v5 z: ] - fi* w/ p4 m( W$ E
- ;;
6 c1 f7 x# ~* U- J4 w0 b& c! D: h - "E")
7 V3 U- V6 ~/ ~& K( ~ - if [ "${createworldDB}" = "YES" ]; then7 c& ^& u, v& x1 d' P7 g3 V. V* B
- createworldDB="NO"0 ^* `# T9 y4 L$ \" H4 h6 \
- else " y* e y3 ^, N! B
- createworldDB="YES", C6 `* D0 T6 h' p1 H* B S! j
- fi $ V, u0 v) o: h
- ;;* X+ L' O, C0 d; n! F
- "W")
( J. j1 d( [3 o& U# e+ Q" B - if [ "${loadworldDB}" = "YES" ]; then; {) ^; P, r( Z8 a3 t. o- [5 V/ M
- loadworldDB="NO"
% W* ^* l# J1 [0 ?% d3 y - else
p' R# I$ q- M - loadworldDB="YES"
/ t0 B8 C9 N% K - fi
; u! E% V# R' C% j# i5 E% i6 [ - ;;
, H/ D: R5 U5 b5 s) f0 I3 M - "D")+ J( a& Q+ `9 u+ G6 P. |; [
- if [ "${dbType}" = "POPULATED" ]; then, }6 Y- v9 t% h* w8 ~! D4 p. v; [" B
- dbType="EMPTY"
7 ^. d1 c: N% s3 y - else + Z1 }( ~% c# O) k1 h( v
- dbType="POPULATED". m3 E- G. c" z8 E+ p9 ~1 U: k
- fi
4 r$ K' X7 w! n2 f8 q( [ - ;;
& Q1 R& T8 M* f, J3 o - "U"); l7 e* b$ d4 i9 m
- if [ "${updateworldDB}" = "YES" ]; then
) T: j1 j- l! j# \0 a6 c% {/ ^ - updateworldDB="NO"" W, R* B! z- G1 c) ^9 R
- else
z& p0 B9 d2 w8 X" T - updateworldDB="YES"
& u; j3 r3 ]% y- M9 r* U9 |/ s/ g - fi
" w, o: G! \( u- h- N9 X$ k - ;;
, q) V4 p& b- [! {; e9 L - "T")
7 n3 e5 `9 h) j( f- J6 M# [2 q) u - if [ "${createrealmDB}" = "YES" ]; then
& p+ ]) _2 x" X! I- p - createrealmDB="NO"
8 H+ {$ i2 k2 Z; D" D' r! P& E - else
) x8 i+ ]" S! P- J4 S - createrealmDB="YES"+ u- n& S" G- S! M: ?+ w
- fi . U1 j. t! U, F9 |1 U9 v
- ;;
2 I2 h9 |/ q+ P) f: c4 l - "R")
- _9 C) T; d( `/ Q - if [ "${loadrealmDB}" = "YES" ]; then
( N! W8 L& m1 @5 X; h - loadrealmDB="NO" 2 |- o2 C7 z5 K$ ]
- else 4 b7 t; F6 h. x7 R, y3 ~
- loadrealmDB="YES") X8 q: ~2 ?9 `
- fi
# f. t/ ^- [1 I; S - ;;
9 Y' c2 k; ^) y2 { - "Y")0 h, n4 v% A7 q# |
- if [ "${updaterealmDB}" = "YES" ]; then5 o: ^# [; l0 {: t0 a y
- updaterealmDB="NO"' K( B# r5 t6 O
- else ! C n5 C( L9 v- N8 Z
- updaterealmDB="YES"
/ j; R! ^" b6 W3 u1 `( d2 B - fi
. ?8 e; J9 j( ^2 \: r2 A - ;;
2 O( ]6 N+ T) d4 K4 o# v1 k' Y - "L")
5 c6 j3 v% D8 i6 k( K - if [ "${addRealmList}" = "YES" ]; then* P- b# k* I- ?
- addRealmList="NO") m1 a9 L: h" J0 K: Z( u
- else ! P& h+ Y( k# r* g# o
- addRealmList="YES"
6 ^- R& w/ Q# W9 P& z+ a - fi3 l. K5 B9 C! G
- ;;( [; N* r" c8 e/ r. e& p) U
- "X")' t% z b; Q, V7 T J, q# V$ g8 d
- exit 0;;5 ~4 S! }" C+ \+ y
- *)1 [! F6 N; Q0 u$ L+ t2 C, t+ M9 |
- printf "Invalid selection";;
% {: U# t# m4 u- E; w: U4 V9 f - esac! B) k+ R- j+ x- o' _0 a
- done( \$ t7 M6 H! o* k7 q
, z% [ I7 r/ h/ D- printBanner
7 w8 v& S4 c6 }- `3 Z- \ - determineDBName: V6 Y) g$ I5 L" z* i* O
- printf "What is your ${dbname} host name ?\t[${svr_def}]: "
0 X g* v( _* \8 v h6 a$ j - read svr
" `9 t1 `5 x6 _8 b7 ?# u" _ - svr=${svr:-${svr_def}}
5 v$ g3 K- y/ p' r% O+ { - printf "What is your ${dbname} user name ?\t[${user_def}]: "! H) W# C+ T" n& e8 J" E' _
- read user) k3 j% a2 ]- _8 V- h
- user=${user:-${user_def}}
8 C& P R! `: |, b$ o+ w - printf "What is your ${dbname} port ?\t[${port_def}]: "
+ E7 n1 b" u% o8 U7 W4 c C0 ]' ?) S - read port/ _% C1 |3 c K* @8 Q
- port=${port:-${port_def}}$ m% } a! i9 S
- if [ $dbname = "MariaDB" ]; then7 G/ Y9 p$ ]; }" c% s1 }
- printf "What is your ${dbname} password ?\t []: "
1 L2 b# ~6 B7 T - read pass
5 v9 z4 {) o7 t' R4 P - pass=${pass:-${pass_def}}/ b# R) R+ c$ R1 G
- elif [ $dbname = "MySQL" ]; then" B3 v) x, x$ A/ z7 U
- mysqlconfigeditor, z7 J' V4 d- S- k
- $dbconfig
H8 o! ^; [+ p6 c - fi
+ L, w. F4 w& Z0 j$ \: A$ B - determineDBCommand
5 G9 d/ {: i" h8 b& r5 z
9 j2 n: p. ]1 B4 y. S- if [ "${DUMP}" = "YES" ]; then) i5 P& G# \/ y, g k3 F
- printf "Enter it again \t[]: "
$ [- O) G: i( O7 G2 u6 U% | - read pass' V4 ?) f0 \; c" J: Q+ d! F9 {2 l
- fi
7 X* r3 _& i" O( a* }+ F% Q% i
& u3 E% t: m/ l% d0 _$ `% o) l- if [ "${createcharDB}" = "YES" ] || [ "${loadcharDB}" = "YES" ] || [ "${updatecharDB}" = "YES" ]; then
- S4 G6 k9 z; M1 X B p - printf "What is your Character database name ?\t[${cdb_def}]: "
/ k0 B7 L) ^9 R2 y! i; u" ?' P - read cdb* \, ~; w" N: a
- cdb=${cdb:-${cdb_def}}3 m8 Z4 j9 v% Q
- fi
1 _) ^+ c) m" |9 I ?! q7 a' U
6 X+ `- Y# r, g( w( ^0 L% n- if [ "${createworldDB}" = "YES" ] || [ "${loadworldDB}" = "YES" ] || [ "${updateworldDB}" = "YES" ]; then
* Z9 C& L/ w& P3 v4 k - printf "What is your World database name ?\t[${wdb_def}]: "5 o9 t" s. y: [6 l$ |2 h2 B2 r* c: q4 U
- read wdb
2 Z9 ^4 L. K9 q4 A8 F - wdb=${wdb:-${wdb_def}}& }- k. [$ j0 M) h! U" y7 ]! O( x2 F
- fi
/ I: @/ W2 h2 u5 B* M - % M7 H8 Y( r8 X& e# l
- if [ "${createrealmDB}" = "YES" ] || [ "${loadrealmDB}" = "YES" ] || [ "${updaterealmDB}" = "YES" ] || [ "${addRealmList}" = "YES" ]; then* m9 ?1 X$ J0 {; \' ?" r7 U2 L& w
- printf "What is your Realm database name ?\t[${rdb_def}]: "3 R' T8 D1 X! b$ t& Y
- read rdb% L4 k3 m2 ?" _# ^. ^8 H
- rdb=${rdb:-${rdb_def}}
& t' V% n2 r# `. m, [ - fi
# |& O5 j% M8 D/ m3 s - 0 a5 S# E7 J2 b3 M( V( Z" H
- if [ "${createcharDB}" = "YES" ]; then) ?' x# r9 F, M0 R j3 u
- createCharDB
5 E* `( |/ \" A. F$ k - fi
- u# `; P/ E8 m& n0 J9 {
8 N1 }3 c8 J' f6 U( k! H4 _- if [ "${createworldDB}" = "YES" ]; then
6 n' U* z: t W" Y. v - createWorldDB' P7 S. ?: m& z( @& M! A% Q
- fi
# N8 G9 J# w* r# H. w - & I& W9 h. @5 _, @
- if [ "${createrealmDB}" = "YES" ]; then
! c4 w& r% n5 a - createRealmDB. e X, s& y; r0 D. s# d
- fi, Q# g [6 l" ]5 o7 r
" M8 d! d( q& g1 X- if [ "${updateworldDB}" = "YES" ]; then
+ n& c! ~3 {' T( D - updateWorldDB# n2 T$ t3 f! Y+ |! g" j/ J! s
- fi+ L: z o4 B6 o* n* T% c8 o/ v
( `+ |% s' I6 a; M L) h$ @- if [ "${updaterealmDB}" = "YES" ]; then0 t6 f9 Z" @1 P+ ^
- updateRealmDB
X& b: s- ?$ _5 d - fi
6 _; v9 `/ _/ | X - : K: `& y2 M# x& G" D
- if [ "${addRealmList}" = "YES" ]; then
: h0 R- {0 k* ]6 F0 J2 t. M - addRealmList
$ y0 e" @: z0 R3 S - fi' l0 H$ d9 W5 e. q/ \# g0 o7 x
h" M5 y& |) I9 U$ V3 t1 j- if [ "${DUMP}" = "YES" ]; then4 H& k) W3 J9 q4 h5 c/ W
- printf "Dumping database information...\n"- w, D- o4 o( n2 h1 o- m4 a/ X
- echo "${svr};${port};${user};${pass};${rdb}" > ~/db.conf1 @$ U* B, H4 J0 s
- echo "${svr};${port};${user};${pass};${wdb}" >> ~/db.conf2 g: s5 ?5 D& q! }3 w8 T
- echo "${svr};${port};${user};${pass};${cdb}" >> ~/db.conf
* I8 k+ h1 R5 a { - fi
& }5 ?% j9 g0 E; _ - 5 f+ n+ _& p5 S& w
- printBanner
) U# C E# j, ^( f. {* F! A - printf "Database creation and load complete :-)\n"
$ r# s- ?& E5 E4 f2 p. s# S - printf "\n"
复制代码
' \# F! z/ G$ E. i2 ~8 K9 l, ^; a |
|