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