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