mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
Bash: implemented installer script for server and modules (beta)
+ minor fixes
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
[[ ${GUARDYVAR:-} -eq 1 ]] && return || readonly GUARDYVAR=1 # include it once
|
||||||
|
|
||||||
# force default language for applications
|
# force default language for applications
|
||||||
LC_ALL=C
|
LC_ALL=C
|
||||||
|
|
||||||
@@ -17,6 +19,8 @@ source "$AC_PATH_CONF/config.sh.dist" # "hack" to avoid missing conf variables
|
|||||||
|
|
||||||
if [ -f "$AC_PATH_CONF/config.sh" ]; then
|
if [ -f "$AC_PATH_CONF/config.sh" ]; then
|
||||||
source "$AC_PATH_CONF/config.sh" # should overwrite previous
|
source "$AC_PATH_CONF/config.sh" # should overwrite previous
|
||||||
|
else
|
||||||
|
echo "NOTICE: file <$AC_PATH_CONF/config.sh> has not been found, you should create and configure it."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -19,6 +19,14 @@ first of all, if you need some custom configuration you have to copy and rename
|
|||||||
./3-build.sh
|
./3-build.sh
|
||||||
|
|
||||||
|
|
||||||
|
## compiler.sh
|
||||||
|
|
||||||
|
compiler.sh script contains an interactive menu to clean/compile/build. You can also run actions directly by command lines specifying the option.
|
||||||
|
Ex:
|
||||||
|
./compiler.sh 3
|
||||||
|
|
||||||
|
It will start the build process (it's equivalent to ./3-build.sh)
|
||||||
|
|
||||||
## Note:
|
## Note:
|
||||||
|
|
||||||
For an optimal development process and **really faster** compilation time, is suggested to use clang instead of gcc
|
For an optimal development process and **really faster** compilation time, is suggested to use clang instead of gcc
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|||||||
source "$CURRENT_PATH/includes/includes.sh"
|
source "$CURRENT_PATH/includes/includes.sh"
|
||||||
|
|
||||||
function all() {
|
function all() {
|
||||||
clean
|
comp_clean
|
||||||
configure
|
comp_configure
|
||||||
build
|
comp_build
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_option() {
|
function run_option() {
|
||||||
@@ -19,7 +19,7 @@ function run_option() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
comp_options=("Clean" "Configure" "Build" "All")
|
comp_options=("Clean" "Configure" "Build" "All")
|
||||||
comp_functions=("clean" "configure" "build" "all")
|
comp_functions=("comp_clean" "comp_configure" "comp_build" "all")
|
||||||
|
|
||||||
runHooks "ON_AFTER_OPTIONS" #you can create your custom options
|
runHooks "ON_AFTER_OPTIONS" #you can create your custom options
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
function clean() {
|
function comp_clean() {
|
||||||
echo "Cleaning build files"
|
echo "Cleaning build files"
|
||||||
|
|
||||||
CWD=$(pwd)
|
CWD=$(pwd)
|
||||||
@@ -13,7 +13,7 @@ function clean() {
|
|||||||
cd $CWD
|
cd $CWD
|
||||||
}
|
}
|
||||||
|
|
||||||
function configure() {
|
function comp_configure() {
|
||||||
CWD=$(pwd)
|
CWD=$(pwd)
|
||||||
|
|
||||||
cd $BUILDPATH
|
cd $BUILDPATH
|
||||||
@@ -39,7 +39,7 @@ function configure() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function build() {
|
function comp_build() {
|
||||||
[ $MTHREADS == 0 ] && MTHREADS=`grep -c ^processor /proc/cpuinfo` && MTHREADS=$(($MTHREADS + 2))
|
[ $MTHREADS == 0 ] && MTHREADS=`grep -c ^processor /proc/cpuinfo` && MTHREADS=$(($MTHREADS + 2))
|
||||||
|
|
||||||
echo "Using $MTHREADS threads"
|
echo "Using $MTHREADS threads"
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ function dbasm_db_import() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function dbasm_import() {
|
function dbasm_import() {
|
||||||
dbasm_run $1 $2 $2
|
dbasm_run $1 $2 $3
|
||||||
|
|
||||||
with_base=$1
|
with_base=$1
|
||||||
with_updates=$2
|
with_updates=$2
|
||||||
|
|||||||
105
bin/installer/includes/functions.sh
Normal file
105
bin/installer/includes/functions.sh
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
function inst_configureOS() {
|
||||||
|
echo "Platform: $OSTYPE"
|
||||||
|
case "$OSTYPE" in
|
||||||
|
solaris*) echo "Solaris is not supported yet" ;;
|
||||||
|
darwin*) source "$AC_PATH_INSTALLER/includes/os_configs/osx.sh" ;;
|
||||||
|
linux*)
|
||||||
|
# TODO: implement different configurations by distro
|
||||||
|
source "$AC_PATH_INSTALLER/includes/os_configs/linux.sh" ;;
|
||||||
|
;;
|
||||||
|
bsd*) echo "BSD is not supported yet" ;;
|
||||||
|
msys*) source "$AC_PATH_INSTALLER/includes/os_configs/windows.sh" ;;
|
||||||
|
*) echo "This platform is not supported" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
function inst_updateRepo() {
|
||||||
|
git pull origin $(git rev-parse --abbrev-ref HEAD)
|
||||||
|
}
|
||||||
|
|
||||||
|
function inst_resetRepo() {
|
||||||
|
git reset --hard $(git rev-parse --abbrev-ref HEAD)
|
||||||
|
git clean -f
|
||||||
|
}
|
||||||
|
|
||||||
|
function inst_compile() {
|
||||||
|
comp_configure
|
||||||
|
comp_build
|
||||||
|
}
|
||||||
|
|
||||||
|
function inst_cleanCompile() {
|
||||||
|
comp_clean
|
||||||
|
inst_compile
|
||||||
|
}
|
||||||
|
|
||||||
|
function inst_assembleDb {
|
||||||
|
dbasm_import true true true
|
||||||
|
}
|
||||||
|
|
||||||
|
function inst_allInOne() {
|
||||||
|
inst_configureOS
|
||||||
|
inst_updateRepo
|
||||||
|
inst_compile
|
||||||
|
inst_assembleDb
|
||||||
|
}
|
||||||
|
|
||||||
|
function inst_module_search {
|
||||||
|
search=""
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Type what to search or leave blank for full list"
|
||||||
|
read -p "Insert name: " res
|
||||||
|
|
||||||
|
search="+$res"
|
||||||
|
fi
|
||||||
|
echo "Searching ..."
|
||||||
|
echo "";
|
||||||
|
|
||||||
|
for i in `curl -s "https://api.github.com/search/repositories?q=org%3Aazerothcore${search}+fork%3Atrue+topic%3Acore-module+sort%3Astars&type=" | grep \"name\" | cut -d ':' -f 2-3|tr -d '",'`; do
|
||||||
|
echo "-> $i";
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "";
|
||||||
|
echo "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function inst_module_install {
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Type the name of the module to install"
|
||||||
|
read -p "Insert name: " res
|
||||||
|
fi
|
||||||
|
|
||||||
|
git clone "https://github.com/azerothcore/$res" "modules/$res" && echo "Done, please re-run compiling and db assembly. Read instruction on module repository for more information"
|
||||||
|
|
||||||
|
echo "";
|
||||||
|
echo "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function inst_module_update {
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Type the name of the module to update"
|
||||||
|
read -p "Insert name: " res
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "modules/$res"
|
||||||
|
|
||||||
|
#git reset --hard master
|
||||||
|
#git clean -f
|
||||||
|
git pull origin master && echo "Done"
|
||||||
|
|
||||||
|
cd "../../"
|
||||||
|
|
||||||
|
echo "";
|
||||||
|
echo "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function inst_module_remove {
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Type the name of the module to remove"
|
||||||
|
read -p "Insert name: " res
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf "modules/$res" && echo "Done"
|
||||||
|
|
||||||
|
echo "";
|
||||||
|
echo "";
|
||||||
|
}
|
||||||
14
bin/installer/includes/includes.sh
Normal file
14
bin/installer/includes/includes.sh
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
source "$CURRENT_PATH/../../bash_shared/includes.sh"
|
||||||
|
|
||||||
|
AC_PATH_INSTALLER="$AC_PATH_BIN/installer"
|
||||||
|
|
||||||
|
if [ -f "$AC_PATH_INSTALLER/config.sh" ]; then
|
||||||
|
source "$AC_PATH_INSTALLER/config.sh" # should overwrite previous
|
||||||
|
fi
|
||||||
|
|
||||||
|
source "$AC_PATH_BIN/compiler/includes/includes.sh"
|
||||||
|
source "$AC_PATH_BIN/db_assembler/includes/includes.sh"
|
||||||
|
|
||||||
|
source "$AC_PATH_INSTALLER/includes/functions.sh"
|
||||||
4
bin/installer/includes/os_configs/linux.sh
Normal file
4
bin/installer/includes/os_configs/linux.sh
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
|
||||||
|
sudo apt-get install git cmake make gcc g++ clang libmysqlclient-dev libssl-dev libbz2-dev libreadline-dev libncurses-dev mysql-server
|
||||||
|
sudo apt-get install libace-6.* libace-dev
|
||||||
6
bin/installer/includes/os_configs/osx.sh
Normal file
6
bin/installer/includes/os_configs/osx.sh
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||||
|
|
||||||
|
brew update
|
||||||
|
|
||||||
|
brew install openssl readline cmake ace coreutils bash bash-completion md5sha1sum
|
||||||
|
|
||||||
17
bin/installer/includes/os_configs/windows.sh
Normal file
17
bin/installer/includes/os_configs/windows.sh
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
echo "WARNING: Installer Script for Windows is not fully supported yet. Work in progress.."
|
||||||
|
echo "!!README!!: Please install openssl and mysql libraries manually following our wiki"
|
||||||
|
|
||||||
|
# install chocolatey before
|
||||||
|
|
||||||
|
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
|
||||||
|
|
||||||
|
# install automatically following packages:
|
||||||
|
# cmake
|
||||||
|
# git
|
||||||
|
# microsoft-build-tools
|
||||||
|
# mysql 5.6
|
||||||
|
|
||||||
|
choco install -y --skip-checksums cmake git git.install microsoft-build-tools
|
||||||
|
choco install -y --skip-checksums mysql --version 5.6.12
|
||||||
|
|
||||||
|
echo "!!README!!: Please remember to install openssl and mysql libraries manually following our wiki"
|
||||||
77
bin/installer/main.sh
Normal file
77
bin/installer/main.sh
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
source "$CURRENT_PATH/includes/includes.sh"
|
||||||
|
|
||||||
|
cmdopt=$1
|
||||||
|
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
echo "===== INSTALLER SCRIPT ====="
|
||||||
|
PS3='Please enter your choice: '
|
||||||
|
options=(
|
||||||
|
"First Installation" "Configure OS dep" "Update Repository" "Reset & Clean Repository"
|
||||||
|
"Compile" "Clean & Compile" "Assemble & Import DB" "Module Search" "Module Install" "Module Update" "Module Remove"
|
||||||
|
"Sub Menu >> Compiler" "Sub Menu >> DB Assembler"
|
||||||
|
"Quit"
|
||||||
|
)
|
||||||
|
|
||||||
|
function _switch() {
|
||||||
|
case $1 in
|
||||||
|
"First Installation")
|
||||||
|
inst_allInOne
|
||||||
|
;;
|
||||||
|
"Configure OS dep")
|
||||||
|
inst_configureOS
|
||||||
|
;;
|
||||||
|
"Update Repository")
|
||||||
|
inst_updateRepo
|
||||||
|
;;
|
||||||
|
"Reset & Clean Repository")
|
||||||
|
inst_resetRepo
|
||||||
|
;;
|
||||||
|
"Compile")
|
||||||
|
inst_compile
|
||||||
|
;;
|
||||||
|
"Clean & Compile")
|
||||||
|
inst_cleanCompile
|
||||||
|
;;
|
||||||
|
"Assemble & Import DB")
|
||||||
|
inst_assembleDb
|
||||||
|
;;
|
||||||
|
"Module Search")
|
||||||
|
inst_module_search $2
|
||||||
|
;;
|
||||||
|
"Module Install")
|
||||||
|
inst_module_install $2
|
||||||
|
;;
|
||||||
|
"Module Update")
|
||||||
|
inst_module_update $2
|
||||||
|
;;
|
||||||
|
"Module Remove")
|
||||||
|
inst_module_remove $2
|
||||||
|
;;
|
||||||
|
"Sub Menu >> Compiler")
|
||||||
|
bash "$AC_PATH_BIN/compiler/compiler.sh"
|
||||||
|
;;
|
||||||
|
"Sub Menu >> DB Assembler")
|
||||||
|
bash "$AC_PATH_BIN/db_assembler/db_assembler.sh"
|
||||||
|
;;
|
||||||
|
"Quit")
|
||||||
|
echo "Goodbye!"
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
*) echo invalid option;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# run option directly if specified in argument
|
||||||
|
[ ! -z $1 ] && _switch "${options[$cmdopt-1]}" && exit 0
|
||||||
|
|
||||||
|
select opt in "${options[@]}"
|
||||||
|
do
|
||||||
|
_switch "$opt"
|
||||||
|
break
|
||||||
|
done
|
||||||
|
done
|
||||||
@@ -1,9 +1,14 @@
|
|||||||
# absolute root path of your azerothshard repository
|
# absolute root path of your azerothshard repository
|
||||||
SRCPATH="$AC_PATH_ROOT"
|
SRCPATH="$AC_PATH_ROOT"
|
||||||
|
|
||||||
|
# absolute path where build files must be stored
|
||||||
|
BUILDPATH="$AC_PATH_ROOT/build/"
|
||||||
|
|
||||||
# absolute path where binary files must be stored
|
# absolute path where binary files must be stored
|
||||||
BINPATH="$AC_PATH_ROOT/build/"
|
BINPATH="$AC_PATH_ROOT/build/bin/"
|
||||||
|
|
||||||
# absolute path where config. files must be stored
|
# absolute path where config. files must be stored
|
||||||
CONFDIR="$AC_PATH_ROOT/build/etc/"
|
CONFDIR="$AC_PATH_ROOT/build/bin/etc/"
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
#
|
#
|
||||||
@@ -12,16 +17,19 @@ CONFDIR="$AC_PATH_ROOT/build/etc/"
|
|||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
|
|
||||||
# set preferred compilers
|
# Set preferred compilers.
|
||||||
|
# To use gcc (not suggested) instead of clang change in:
|
||||||
|
# CCOMPILERC="/usr/bin/gcc"
|
||||||
|
# CCOMPILERCXX="/usr/bin/g++"
|
||||||
|
#
|
||||||
CCOMPILERC="/usr/bin/clang"
|
CCOMPILERC="/usr/bin/clang"
|
||||||
CCOMPILERCXX="/usr/bin/clang++"
|
CCOMPILERCXX="/usr/bin/clang++"
|
||||||
#CCOMPILERC="/usr/bin/gcc"
|
|
||||||
#CCOMPILERCXX="/usr/bin/g++"
|
|
||||||
|
|
||||||
# how many thread must be used for compilation ( leave zero to use all available )
|
# how many thread must be used for compilation ( leave zero to use all available )
|
||||||
MTHREADS=0
|
MTHREADS=0
|
||||||
# enable/disable warnings during compilation
|
# enable/disable warnings during compilation
|
||||||
CWARNINGS=OFF
|
CWARNINGS=ON
|
||||||
# enable/disable some debug informations ( it's not a debug compilation )
|
# enable/disable some debug informations ( it's not a debug compilation )
|
||||||
CDEBUG=OFF
|
CDEBUG=OFF
|
||||||
# specify compilation type
|
# specify compilation type
|
||||||
@@ -31,13 +39,18 @@ CSCRIPTS=ON
|
|||||||
# compile server
|
# compile server
|
||||||
CSERVERS=ON
|
CSERVERS=ON
|
||||||
# compile tools
|
# compile tools
|
||||||
CTOOLS=OFF
|
CTOOLS=ON
|
||||||
# use precompiled headers ( fatest compilation but not optimized if you change headers often )
|
# use precompiled headers ( fatest compilation but not optimized if you change headers often )
|
||||||
CSCRIPTPCH=ON
|
CSCRIPTPCH=ON
|
||||||
CCOREPCH=ON
|
CCOREPCH=ON
|
||||||
|
|
||||||
|
# Skip specific modules from compilation (cmake reconfigure needed)
|
||||||
# use semicolon ; to separate modules
|
# use semicolon ; to separate modules
|
||||||
CDISABLED_AC_MODULES=""
|
CDISABLED_AC_MODULES=""
|
||||||
|
|
||||||
# you can add your custom definitions here ( -D )
|
# you can add your custom definitions here ( -D )
|
||||||
|
# example: CCUSTOMOPTIONS=" -DWITH_PERFTOOLS=ON -DENABLE_EXTRA_LOGS=ON"
|
||||||
|
#
|
||||||
CCUSTOMOPTIONS=""
|
CCUSTOMOPTIONS=""
|
||||||
|
|
||||||
|
|
||||||
@@ -47,6 +60,11 @@ CCUSTOMOPTIONS=""
|
|||||||
#
|
#
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
|
#
|
||||||
|
# Basically you don't have to edit it
|
||||||
|
# but if you have another database you can add it here
|
||||||
|
# and create relative confiugurations below
|
||||||
|
#
|
||||||
DATABASES=(
|
DATABASES=(
|
||||||
"AUTH"
|
"AUTH"
|
||||||
"CHARACTERS"
|
"CHARACTERS"
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ PATH_MODULES="$CUR_PATH/modules/"
|
|||||||
source "$PATH_MODULES/drassil/joiner/joiner.sh"
|
source "$PATH_MODULES/drassil/joiner/joiner.sh"
|
||||||
|
|
||||||
|
|
||||||
|
# installing repository dependencies
|
||||||
if [[ $1 == "dev" ]]; then
|
if [[ $1 == "dev" ]]; then
|
||||||
git submodule update --init "$CUR_PATH/data/doc"
|
git submodule update --init "$CUR_PATH/data/doc"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
source "$CUR_PATH/bin/installer/main.sh"
|
||||||
|
|||||||
Reference in New Issue
Block a user