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