diff --git a/bin/bash_shared/includes.sh b/bin/bash_shared/includes.sh index 3e53937a2..11022c609 100644 --- a/bin/bash_shared/includes.sh +++ b/bin/bash_shared/includes.sh @@ -5,3 +5,9 @@ AZTH_PATH_SHARED="$AZTH_PATH_BIN/bash_shared" source "$AZTH_PATH_SHARED/defines.sh" source "$AZTH_PATH_SHARED/functions.sh" + +source "$AZTH_PATH_CONF/config.sh.dist" # "hack" to avoid missing conf variables + +if [ -f "$AZTH_PATH_CONF/config.sh" ]; then + source "$AZTH_PATH_CONF/config.sh" # should overwrite previous +fi diff --git a/bin/compiler/1-clean.sh b/bin/compiler/1-clean.sh index 7fbe9a84b..fc27e2bed 100755 --- a/bin/compiler/1-clean.sh +++ b/bin/compiler/1-clean.sh @@ -1,8 +1,5 @@ #!/bin/bash + CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -source "$CURRENT_PATH/includes/common.sh" - -source "$CURRENT_PATH/includes/includes.sh" - -clean +bash "$CURRENT_PATH/compiler.sh" 1 diff --git a/bin/compiler/2-configure.sh b/bin/compiler/2-configure.sh index 6acc93468..9c610576c 100755 --- a/bin/compiler/2-configure.sh +++ b/bin/compiler/2-configure.sh @@ -1,8 +1,5 @@ #!/bin/bash + CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -source "$CURRENT_PATH/includes/common.sh" - -source "$CURRENT_PATH/includes/includes.sh" - -configure +bash "$CURRENT_PATH/compiler.sh" 2 diff --git a/bin/compiler/3-build.sh b/bin/compiler/3-build.sh index 20b77ecb4..126da69cf 100755 --- a/bin/compiler/3-build.sh +++ b/bin/compiler/3-build.sh @@ -1,8 +1,5 @@ #!/bin/bash + CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -source "$CURRENT_PATH/includes/common.sh" - -source "$CURRENT_PATH/includes/includes.sh" - -build +bash "$CURRENT_PATH/compiler.sh" 3 diff --git a/bin/compiler/README.md b/bin/compiler/README.md index f42350166..c50dae2ec 100644 --- a/bin/compiler/README.md +++ b/bin/compiler/README.md @@ -1,7 +1,7 @@ ## How to compile: first of all, if you need some custom configuration you have to copy and rename -config.sh.dist in config.sh and configure it +/conf/config.sh.dist in /conf/config.sh and configure it * for a "clean" compilation you must run all scripts in their order: @@ -21,4 +21,4 @@ config.sh.dist in config.sh and configure it ## Note: -For an optimal development process and **really faster** compilation time, is suggested to use clang instead of gcc \ No newline at end of file +For an optimal development process and **really faster** compilation time, is suggested to use clang instead of gcc diff --git a/bin/compiler/compiler.sh b/bin/compiler/compiler.sh new file mode 100755 index 000000000..187a16ed1 --- /dev/null +++ b/bin/compiler/compiler.sh @@ -0,0 +1,43 @@ +#!/bin/bash +CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +source "$CURRENT_PATH/includes/includes.sh" + +function all() { + clean + configure + build +} + +function run_option() { + if test "${comp_functions[$1-1]+'test'}"; then + ${comp_functions[$1-1]} + else + echo "invalid option" + fi +} + +comp_options=("Clean" "Configure" "Build" "All") +comp_functions=("clean" "configure" "build" "all") + +runHooks "ON_AFTER_OPTIONS" #you can create your custom options + +# push exit after custom options +comp_options+=('Exit') +comp_functions+=('exit 0') + +# run option directly if specified in argument +[ ! -z $1 ] && run_option $1 && exit 0 + +PS3='[ Please enter your choice ]: ' +select opt in "${comp_options[@]}" +do + case $opt in + 'Exit') + break + ;; + *) + run_option $REPLY + ;; + esac +done diff --git a/bin/compiler/config.sh.dist b/bin/compiler/config.sh.dist deleted file mode 100644 index e0b9ba320..000000000 --- a/bin/compiler/config.sh.dist +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - - -# set preferred compilers -#CCOMPILERC="/usr/bin/clang-3.6" -#CCOMPILERCC="/usr/bin/clang-3.6" -#CCOMPILERCXX="/usr/bin/clang++-3.6" -CCOMPILERC="/usr/bin/gcc" -CCOMPILERCC="/usr/bin/gcc" -CCOMPILERCXX="/usr/bin/g++" - -# how many thread must be used for compilation ( leave zero to use all available ) -MTHREADS=0 -# enable/disable warnings during compilation -CWARNINGS=1 -# enable/disable some debug informations ( it's not a debug compilation ) -CDEBUG=0 -# specify compilation type -CCTYPE=Release -# compile scripts -CSCRIPTS=1 -# compile server -CSERVERS=1 -# compile tools -CTOOLS=0 -# use precompiled headers ( fatest compilation but not optimized if you change headers often ) -CSCRIPTPCH=1 -CCOREPCH=1 - -# absolute root path of your azerothshard repository -SRCPATH= -# absolute path where binary files must be stored -BINPATH= -# absolute path where config. files must be stored -CONFDIR= - - - diff --git a/bin/compiler/includes/common.sh b/bin/compiler/includes/common.sh deleted file mode 100644 index 61a73ca13..000000000 --- a/bin/compiler/includes/common.sh +++ /dev/null @@ -1,5 +0,0 @@ -source "./config.sh.dist" # "hack" to avoid missing conf variables - -if [ -f "./config.sh" ]; then - source "./config.sh" # should overwrite previous -fi diff --git a/bin/db_assembler/.gitignore b/bin/db_assembler/.gitignore index 0d5bd649d..ca3f4fb1f 100644 --- a/bin/db_assembler/.gitignore +++ b/bin/db_assembler/.gitignore @@ -1,2 +1,2 @@ /output/ -config.sh + diff --git a/bin/db_assembler/config.sh.dist b/bin/db_assembler/config.sh.dist deleted file mode 100644 index 87f6cbabf..000000000 --- a/bin/db_assembler/config.sh.dist +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -# 0 if you want create an sql for each kind of following categories -# 1 to create a single big file to import ( suggested for new installations ) -ALL_IN_ONE=0 - -DATABASES=( - "AUTH" - "CHARACTERS" - "WORLD" -) - -OUTPUT_FOLDER="output/" - -# FULL DB -DB_CHARACTERS_PATHS=( - $SRCPATH"/data/sql/databases/characters.sql" -) - -DB_AUTH_PATHS=( - $SRCPATH"/data/sql/databases/auth.sql" -) - -DB_WORLD_PATHS=( - $SRCPATH"/data/sql/databases/world.sql" -) - -# UPDATES -DB_CHARACTERS_UPDATE_PATHS=( - $SRCPATH"/data/sql/updates/characters/" -) - -DB_AUTH_UPDATE_PATHS=( - $SRCPATH"/data/sql/updates/auth/" -) - -DB_WORLD_UPDATE_PATHS=( - $SRCPATH"/data/sql/updates/world/" -) - -# CUSTOM -DB_CHARACTERS_CUSTOM_PATHS=( -) - -DB_AUTH_CUSTOM_PATHS=( -) - -DB_WORLD_CUSTOM_PATHS=( -) diff --git a/bin/db_assembler/db_assembler.sh b/bin/db_assembler/db_assembler.sh index 2a29e2f3f..620b5353a 100755 --- a/bin/db_assembler/db_assembler.sh +++ b/bin/db_assembler/db_assembler.sh @@ -26,8 +26,8 @@ function assemble() { database=$1 start_sql=$2 - var_full="DB_"$database"_PATHS" - full=${!var_full} + var_base="DB_"$database"_PATHS" + base=${!var_full} var_updates="DB_"$database"_UPDATE_PATHS" updates=${!var_updates} @@ -47,16 +47,27 @@ function assemble() { echo "" > $OUTPUT_FOLDER$database$suffix_base".sql" - if [ ! ${#full[@]} -eq 0 ]; then - echo "Generating $OUTPUT_FOLDER$database$suffix_based ..." + if [ ! ${#base[@]} -eq 0 ]; then + echo "Generating $OUTPUT_FOLDER$database$suffix_base ..." - for entry in "${full[@]}" + for d in "${base[@]}" do - if [ ! -z $entry ]; then - if [ -e $entry ]; then - cat "$entry" >> $OUTPUT_FOLDER$database$suffix_base".sql" - fi - fi + for entry in "$d"/*.sql "$d"/**/*.sql + do + if [ ! -z $d ]; then + file=$(basename $entry) + if [[ "$file" > "$start_sql" ]] + then + if [ -e $entry ]; then + if [[ "$gtversion" < "$file" ]]; then + gtversion=$file + fi + + cat "$entry" >> $OUTPUT_FOLDER$database$suffix_base".sql" + fi + fi + fi + done done fi diff --git a/bin/runners/config.dist b/bin/runners/config.dist deleted file mode 100644 index 6b5b27554..000000000 --- a/bin/runners/config.dist +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -###################### - -# enable/disable GDB execution -export GDB_ENABLED=0 - -# gdb file -export GDB="" - -# directory where binary are stored -exoirt BINPATH="" - - ### Put here the pid you configured on your worldserver.conf file ### -export SERVERPID="" - -# path to conf file -export CONFIG="" - -# path of log files -export LOGS_PATH=""; - -# exec name -export SERVERBIN="" - -# name of screen service ( for restarter ) -export SCREEN_NAME="" - -###################### - - diff --git a/bin/runners/starter b/bin/runners/starter index 4cd6dd241..675bb13fb 100755 --- a/bin/runners/starter +++ b/bin/runners/starter @@ -7,11 +7,10 @@ SYSERR="$5" GBD_ENABLED="$6" if [ $GBD_ENABLED -eq 1 ]; then - echo "run -c $3" > "$GDB_FILE" + echo "set logging on" > "$GDB_FILE" + echo "set debug timestamp" >> "$GDB_FILE" + echo "run -c $3" >> "$GDB_FILE" echo "bt" >> "$GDB_FILE" - echo "bt full" >> "$GDB_FILE" - echo "info threads" >> "$GDB_FILE" - echo "thread apply all bt full" >> "$GDB_FILE" [ ! -f "$SYSLOG" ] && touch "$SYSLOG" [ ! -f "$SYSERR" ] && touch "$SYSERR" @@ -19,4 +18,4 @@ if [ $GBD_ENABLED -eq 1 ]; then gdb -x $GDB_FILE --batch $1 >> "$SYSLOG" 2>> "$SYSERR" elif [ $GBD_ENABLED -eq 0 ]; then "./$1" -c "$CONFIG" -fi \ No newline at end of file +fi diff --git a/conf/config.sh.dist b/conf/config.sh.dist new file mode 100644 index 000000000..1952ca984 --- /dev/null +++ b/conf/config.sh.dist @@ -0,0 +1,130 @@ +#!/bin/bash + +#!/bin/bash + + +# absolute root path of your azerothshard repository +SRCPATH="$AZTH_PATH_ROOT" +# absolute path where binary files must be stored +BINPATH="$AZTH_PATH_ROOT/build/" +# absolute path where config. files must be stored +CONFDIR="$AZTH_PATH_ROOT/build/etc/" + +############################################## +# +# COMPILER_CONFIGURATIONS +# +############################################## + + +# set preferred compilers +#CCOMPILERC="/usr/bin/clang-3.6" +#CCOMPILERCC="/usr/bin/clang-3.6" +#CCOMPILERCXX="/usr/bin/clang++-3.6" +CCOMPILERC="/usr/bin/gcc" +CCOMPILERCC="/usr/bin/gcc" +CCOMPILERCXX="/usr/bin/g++" + +# how many thread must be used for compilation ( leave zero to use all available ) +MTHREADS=0 +# enable/disable warnings during compilation +CWARNINGS=1 +# enable/disable some debug informations ( it's not a debug compilation ) +CDEBUG=0 +# specify compilation type +CCTYPE=Release +# compile scripts +CSCRIPTS=1 +# compile server +CSERVERS=1 +# compile tools +CTOOLS=0 +# use precompiled headers ( fatest compilation but not optimized if you change headers often ) +CSCRIPTPCH=1 +CCOREPCH=1 + +############################################## +# +# RUNNER CONFIGURATION +# +############################################## + +# enable/disable GDB execution +export GDB_ENABLED=0 + +# gdb file +export GDB="" + +# directory where binary are stored +exoirt BINPATH="" + + ### Put here the pid you configured on your worldserver.conf file ### +export SERVERPID="" + +# path to conf file +export CONFIG="" + +# path of log files +export LOGS_PATH=""; + +# exec name +export SERVERBIN="" + +# name of screen service ( for restarter ) +export SCREEN_NAME="" + + +############################################## +# +# DB ASSEMBLER CONFIGURATIONS +# +############################################## + + +# 0 if you want create an sql for each kind of following categories +# 1 to create a single big file to import ( suggested for new installations ) +ALL_IN_ONE=0 + +DATABASES=( + "AUTH" + "CHARACTERS" + "WORLD" +) + +OUTPUT_FOLDER="output/" + +# FULL DB +DB_CHARACTERS_PATHS=( + $SRCPATH"/data/sql/databases/" +) + +DB_AUTH_PATHS=( + $SRCPATH"/data/sql/databases/" +) + +DB_WORLD_PATHS=( + $SRCPATH"/data/sql/databases/" +) + +# UPDATES +DB_CHARACTERS_UPDATE_PATHS=( + $SRCPATH"/data/sql/updates/characters/" +) + +DB_AUTH_UPDATE_PATHS=( + $SRCPATH"/data/sql/updates/auth/" +) + +DB_WORLD_UPDATE_PATHS=( + $SRCPATH"/data/sql/updates/world/" +) + +# CUSTOM +DB_CHARACTERS_CUSTOM_PATHS=( +) + +DB_AUTH_CUSTOM_PATHS=( +) + +DB_WORLD_CUSTOM_PATHS=( +)