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