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