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