diff options
author | ShinDarth <borzifrancesco@gmail.com> | 2016-08-07 14:55:21 +0200 |
---|---|---|
committer | ShinDarth <borzifrancesco@gmail.com> | 2016-08-07 14:55:21 +0200 |
commit | a7a81f90b191aeabebc768ff18807abf6d655a0c (patch) | |
tree | 369c1e94a8270ac4a5ea60cfa14243bb6866f043 /bin | |
parent | b96f058c175657aa85047f4200196bdd952c9888 (diff) | |
parent | 1fcfb9af5a0a8e4d308ec2ccda20adab99dce3ec (diff) |
Merge branch 'master' into git
Diffstat (limited to 'bin')
-rw-r--r-- | bin/bash_shared/defines.sh | 2 | ||||
-rw-r--r-- | bin/bash_shared/includes.sh | 17 | ||||
-rw-r--r-- | bin/compiler/.gitignore | 2 | ||||
-rwxr-xr-x | bin/compiler/1-clean.sh | 7 | ||||
-rwxr-xr-x | bin/compiler/2-configure.sh | 7 | ||||
-rwxr-xr-x | bin/compiler/3-build.sh | 7 | ||||
-rw-r--r-- | bin/compiler/README.md | 4 | ||||
-rwxr-xr-x | bin/compiler/compiler.sh | 43 | ||||
-rw-r--r-- | bin/compiler/config.sh.dist | 38 | ||||
-rw-r--r-- | bin/compiler/includes/common.sh | 5 | ||||
-rw-r--r-- | bin/compiler/includes/defines.sh | 4 | ||||
-rw-r--r-- | bin/compiler/includes/functions.sh | 6 | ||||
-rw-r--r-- | bin/compiler/includes/includes.sh | 4 | ||||
-rw-r--r-- | bin/db_assembler/config.sh.dist | 49 | ||||
-rwxr-xr-x | bin/db_assembler/db_assembler.sh | 230 | ||||
-rw-r--r-- | bin/runners/config.dist | 31 | ||||
-rwxr-xr-x | bin/runners/starter | 9 |
17 files changed, 210 insertions, 255 deletions
diff --git a/bin/bash_shared/defines.sh b/bin/bash_shared/defines.sh index 67cde98ef9..6020ca871d 100644 --- a/bin/bash_shared/defines.sh +++ b/bin/bash_shared/defines.sh @@ -2,4 +2,6 @@ AZTH_PATH_ROOT=$(readlink -f "$AZTH_PATH_BIN/../") AZTH_PATH_CONF="$AZTH_PATH_ROOT/conf" +AZTH_PATH_MODULES="$AZTH_PATH_ROOT/modules" + AZTH_PATH_CUSTOM=$(readlink -f "$AZTH_PATH_ROOT/../azth_custom") diff --git a/bin/bash_shared/includes.sh b/bin/bash_shared/includes.sh index 3e53937a2b..966e622970 100644 --- a/bin/bash_shared/includes.sh +++ b/bin/bash_shared/includes.sh @@ -5,3 +5,20 @@ 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 + +# +# Load modules +# + +for entry in "$AZTH_PATH_MODULES/"*/include.sh +do + if [ -e $entry ]; then + source $entry + fi +done diff --git a/bin/compiler/.gitignore b/bin/compiler/.gitignore new file mode 100644 index 0000000000..ba57f2bccf --- /dev/null +++ b/bin/compiler/.gitignore @@ -0,0 +1,2 @@ +config.sh + diff --git a/bin/compiler/1-clean.sh b/bin/compiler/1-clean.sh index 7fbe9a84b5..fc27e2bedb 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" +CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -clean +bash "$CURRENT_PATH/compiler.sh" 1 diff --git a/bin/compiler/2-configure.sh b/bin/compiler/2-configure.sh index 6acc934686..9c610576c0 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" +CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -configure +bash "$CURRENT_PATH/compiler.sh" 2 diff --git a/bin/compiler/3-build.sh b/bin/compiler/3-build.sh index 20b77ecb44..126da69cfa 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" +CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -build +bash "$CURRENT_PATH/compiler.sh" 3 diff --git a/bin/compiler/README.md b/bin/compiler/README.md index f423501669..c50dae2ec2 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 0000000000..187a16ed14 --- /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 e0b9ba3205..0000000000 --- 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 61a73ca130..0000000000 --- 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/compiler/includes/defines.sh b/bin/compiler/includes/defines.sh index e6b37f4eae..e8324e92c4 100644 --- a/bin/compiler/includes/defines.sh +++ b/bin/compiler/includes/defines.sh @@ -11,6 +11,6 @@ BUILDPATH=$BINPATH INSTALL_PATH=$(readlink -f "$BINPATH/../") -[ $CCTYPE == "Debug" ] && BUILDPATH="$BUILDPATH/debug/build/" || BUILDPATH="$BUILDPATH/release/build/" +[ $CTYPE == "Debug" ] && BUILDPATH="$BUILDPATH/debug/build/" || BUILDPATH="$BUILDPATH/release/build/" -[ $CCTYPE == "Debug" ] && BINPATH="$BINPATH/debug" || BINPATH="$BINPATH/release" +[ $CTYPE == "Debug" ] && BINPATH="$BINPATH/debug" || BINPATH="$BINPATH/release" diff --git a/bin/compiler/includes/functions.sh b/bin/compiler/includes/functions.sh index ba268173fb..d8fe078b99 100644 --- a/bin/compiler/includes/functions.sh +++ b/bin/compiler/includes/functions.sh @@ -20,7 +20,7 @@ function configure() { echo "Build path: $BUILDPATH" echo "DEBUG info: $CDEBUG" - echo "Compilation type: $CCTYPE" + echo "Compilation type: $CTYPE" # -DCMAKE_BUILD_TYPE=$CCTYPE disable optimization "slow and huge amount of ram" # -DWITH_COREDEBUG=$CDEBUG compiled with debug information @@ -30,8 +30,8 @@ function configure() { cmake $SRCPATH -DCMAKE_INSTALL_PREFIX=$BINPATH -DCONF_DIR=$CONFDIR -DSERVERS=$CSERVERS \ -DSCRIPTS=$CSCRIPTS \ - -DTOOLS=$CTOOLS -DUSE_SCRIPTPCH=$CSCRIPTPCH -DUSE_COREPCH=$CCOREPCH -DWITH_COREDEBUG=$CDEBUG -DCMAKE_BUILD_TYPE=$CCTYPE -DWITH_WARNINGS=$CWARNINGS \ - -DCMAKE_C_COMPILER=$CCOMPILERC -DCMAKE_CXX_COMPILER=$CCOMPILERCXX + -DTOOLS=$CTOOLS -DUSE_SCRIPTPCH=$CSCRIPTPCH -DUSE_COREPCH=$CCOREPCH -DWITH_COREDEBUG=$CDEBUG -DCMAKE_BUILD_TYPE=$CTYPE -DWITH_WARNINGS=$CWARNINGS \ + -DCMAKE_C_COMPILER=$CCOMPILERC -DCMAKE_CXX_COMPILER=$CCOMPILERCXX $CCUSTOMOPTIONS cd $CWD diff --git a/bin/compiler/includes/includes.sh b/bin/compiler/includes/includes.sh index 4150841891..1396accb1f 100644 --- a/bin/compiler/includes/includes.sh +++ b/bin/compiler/includes/includes.sh @@ -4,6 +4,10 @@ source "$CURRENT_PATH/../../bash_shared/includes.sh" AZTH_PATH_COMPILER="$AZTH_PATH_BIN/compiler" +if [ -f "$AZTH_PATH_COMPILER/config.sh" ]; then + source "$AZTH_PATH_COMPILER/config.sh" # should overwrite previous +fi + function azth_on_after_build() { # move the run engine cp -rvf "$AZTH_PATH_BIN/runners/"* "$INSTALL_PATH/bin/" diff --git a/bin/db_assembler/config.sh.dist b/bin/db_assembler/config.sh.dist deleted file mode 100644 index 87f6cbabf6..0000000000 --- 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 bbc75e7380..d5bf3fac1f 100755 --- a/bin/db_assembler/db_assembler.sh +++ b/bin/db_assembler/db_assembler.sh @@ -7,128 +7,148 @@ else SRCPATH=$(readlink -f "../../") fi -# -# You can pass latest version as first argument of this script -# -if [ -z "$1" ]; then - read -p "Enter latest sql version ( leave blank to use : 0000_00_00_00 )" $version - version=${version:-0000_00_00_00} +source $SRCPATH"/bin/bash_shared/includes.sh" + +if [ -f "./config.sh" ]; then + source "./config.sh" # should overwrite previous +fi + +unamestr=`uname` +if [[ "$unamestr" == 'Darwin' ]]; then + MD5_CMD="md5" else - version=$1 + MD5_CMD="md5sum" fi -source "./config.sh.dist" # "hack" to avoid missing conf variables +reg_file="$OUTPUT_FOLDER/.zzz_db_assembler_registry.sh" -if [ -f "./config.sh" ]; then - source "./config.sh" # should overwrite previous +declare -A registry + +if [ -f "$reg_file" ]; then + source "$reg_file" fi echo "===== STARTING PROCESS =====" -gtversion="" function assemble() { - database=$1 - start_sql=$2 - - var_full="DB_"$database"_PATHS" - full=${!var_full} - - var_updates="DB_"$database"_UPDATE_PATHS" - updates=${!var_updates} - - var_custom="DB_"$database"_CUSTOM_PATHS" - custom=${!var_custom} - - - suffix_base="" - suffix_upd="" - suffix_custom="" - - if (( $ALL_IN_ONE == 0 )); then - suffix_base="_base" - fi; - - echo "" > $OUTPUT_FOLDER$database$suffix_base".sql" - - - if [ ! ${#full[@]} -eq 0 ]; then - echo "Generating $OUTPUT_FOLDER$database$suffix_based ..." - - for entry in "${full[@]}" - do - if [ ! -z $entry ]; then - if [ -e $entry ]; then - cat "$entry" >> $OUTPUT_FOLDER$database$suffix_base".sql" - fi - fi - done - fi - - if (( $ALL_IN_ONE == 0 )); then - suffix_upd="_updates" - - echo "" > $OUTPUT_FOLDER$database$suffix_upd".sql" - fi; - - if [ ! ${#updates[@]} -eq 0 ]; then - echo "Generating $OUTPUT_FOLDER$database$suffix_upd ..." - - for d in "${updates[@]}" - do - 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_upd".sql" - fi - fi - fi - done - done - fi - - if (( $ALL_IN_ONE == 0 )); then - suffix_custom="_custom" - - echo "" > $OUTPUT_FOLDER$database$suffix_custom".sql" - fi; - - - - if [ ! ${#custom[@]} -eq 0 ]; then - echo "Generating $OUTPUT_FOLDER$database$suffix_custom ..." - - for d in "${custom[@]}" - do - if [ ! -z $d ]; then - for entry in "$d"/*.sql "$d"/**/*.sql - do - if [ -e $entry ]; then - cat "$entry" >> $OUTPUT_FOLDER$database$suffix_custom".sql" - fi - done - fi - done - fi + database=$1 + start_sql=$2 + + var_base="DB_"$database"_PATHS" + base=${!var_base} + + var_updates="DB_"$database"_UPDATE_PATHS" + updates=${!var_updates} + + var_custom="DB_"$database"_CUSTOM_PATHS" + custom=${!var_custom} + + + suffix_base="" + suffix_upd="" + suffix_custom="" + + if (( $ALL_IN_ONE == 0 )); then + suffix_base="_base" + fi; + + echo "" > $OUTPUT_FOLDER$database$suffix_base".sql" + + + if [ ! ${#base[@]} -eq 0 ]; then + echo "Generating $OUTPUT_FOLDER$database$suffix_base ..." + + for d in "${base[@]}" + do + if [ ! -z $d ]; then + for entry in "$d"/*.sql "$d"/**/*.sql + do + if [[ -e $entry ]]; then + cat "$entry" >> $OUTPUT_FOLDER$database$suffix_base".sql" + fi + done + fi + done + fi + + if (( $ALL_IN_ONE == 0 )); then + suffix_upd="_updates" + + echo "" > $OUTPUT_FOLDER$database$suffix_upd".sql" + fi; + + if [ ! ${#updates[@]} -eq 0 ]; then + echo "Generating $OUTPUT_FOLDER$database$suffix_upd ..." + + for d in "${updates[@]}" + do + if [ ! -z $d ]; then + for entry in "$d"/*.sql "$d"/**/*.sql + do + if [[ ! -e $entry ]]; then + continue + fi + + file=$(basename "$entry") + hash=$($MD5_CMD "$entry") + hash="${hash%% *}" #remove file path + if [[ -z ${registry[$hash]} ]]; then + registry["$hash"]="$file" + echo "-- New update sql: "$file + cat "$entry" >> $OUTPUT_FOLDER$database$suffix_upd".sql" + fi + done + fi + done + fi + + if (( $ALL_IN_ONE == 0 )); then + suffix_custom="_custom" + + echo "" > $OUTPUT_FOLDER$database$suffix_custom".sql" + fi; + + + + if [ ! ${#custom[@]} -eq 0 ]; then + echo "Generating $OUTPUT_FOLDER$database$suffix_custom ..." + + for d in "${custom[@]}" + do + if [ ! -z $d ]; then + for entry in "$d"/*.sql "$d"/**/*.sql + do + if [[ ! -e $entry ]]; then + continue + fi + + file=$(basename "$entry") + hash=$($MD5_CMD "$entry") + hash="${hash%% *}" #remove file path + if [[ -z ${registry[$hash]} ]]; then + registry["$hash"]="$file" + echo "-- New custom sql: "$file + cat "$entry" >> $OUTPUT_FOLDER$database$suffix_custom".sql" + fi + done + fi + done + fi } mkdir -p $OUTPUT_FOLDER for db in ${DATABASES[@]} do - assemble "$db" $version".sql" + assemble "$db" $version".sql" done -rm $OUTPUT_FOLDER"ZZZ_latest_version_"* -echo $gtversion > $OUTPUT_FOLDER"ZZZ_latest_version_"${gtversion%.*} +echo "" > $reg_file -echo "===== DONE =====" +for i in "${!registry[@]}" +do + echo "registry['"$i"']='"${registry[$i]}"'" >> "$reg_file" +done +echo "===== DONE =====" diff --git a/bin/runners/config.dist b/bin/runners/config.dist deleted file mode 100644 index 6b5b275544..0000000000 --- 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 4cd6dd2411..675bb13fb8 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 |