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