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