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