summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/bash_shared/includes.sh2
-rw-r--r--apps/compiler/includes/functions.sh7
-rw-r--r--apps/installer/includes/functions.sh29
-rw-r--r--apps/startup-scripts/simple-restarter31
-rw-r--r--conf/config.sh.dist4
5 files changed, 58 insertions, 15 deletions
diff --git a/apps/bash_shared/includes.sh b/apps/bash_shared/includes.sh
index 312b5ad19b..1817683ad9 100644
--- a/apps/bash_shared/includes.sh
+++ b/apps/bash_shared/includes.sh
@@ -13,3 +13,5 @@ source "$AC_PATH_DEPS/hw-core/bash-lib-event/src/hooks.sh"
source "$AC_PATH_SHARED/common.sh"
+[[ "$OSTYPE" = "msys" ]] && AC_BINPATH_FULL="$BINPATH" || AC_BINPATH_FULL="$BINPATH/bin"
+
diff --git a/apps/compiler/includes/functions.sh b/apps/compiler/includes/functions.sh
index 0275717ebc..92d2d7bdcd 100644
--- a/apps/compiler/includes/functions.sh
+++ b/apps/compiler/includes/functions.sh
@@ -28,7 +28,12 @@ function comp_configure() {
#-DSCRIPTS_NORTHREND=$CSCRIPTS -DSCRIPTS_OUTDOORPVP=$CSCRIPTS -DSCRIPTS_OUTLAND=$CSCRIPTS -DSCRIPTS_PET=$CSCRIPTS -DSCRIPTS_SPELLS=$CSCRIPTS -DSCRIPTS_WORLD=$CSCRIPTS \
#-DAC_WITH_UNIT_TEST=$CAC_UNIT_TEST -DAC_WITH_PLUGINS=$CAC_PLG \
- cmake $SRCPATH -DCMAKE_INSTALL_PREFIX=$BINPATH -DCONF_DIR=$CONFDIR -DSERVERS=$CSERVERS \
+ local DCONF=""
+ if [ ! -z "$CONFDIR" ]; then
+ DCONF="-DCONF_DIR=$CONFDIR"
+ fi
+
+ cmake $SRCPATH -DCMAKE_INSTALL_PREFIX=$BINPATH $DCONF -DSERVERS=$CSERVERS \
-DSCRIPTS=$CSCRIPTS \
-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 "-DDISABLED_AC_MODULES=$CDISABLED_AC_MODULES" $CCUSTOMOPTIONS
diff --git a/apps/installer/includes/functions.sh b/apps/installer/includes/functions.sh
index 987fe5e3c8..31284aa197 100644
--- a/apps/installer/includes/functions.sh
+++ b/apps/installer/includes/functions.sh
@@ -48,7 +48,7 @@ function inst_allInOne() {
inst_configureOS
inst_updateRepo
inst_compile
- inst_assembleDb
+ dbasm_import true true true
}
function inst_getVersionBranch() {
@@ -107,7 +107,7 @@ function inst_module_search {
read v b < <(inst_getVersionBranch "https://raw.githubusercontent.com/azerothcore/$mod/master/acore-module.json")
if [[ "$b" != "none" ]]; then
- echo "-> $mod (tested with AC v$v)"
+ echo "-> $mod (tested with AC version: $v)"
else
echo "-> $mod (no revision available for AC v$AC_VERSION, it could not work!)"
fi
@@ -154,10 +154,16 @@ function inst_module_update {
_tmp=$PWD
if [ -d "$J_PATH_MODULES/$res/" ]; then
+ read v b < <(inst_getVersionBranch "https://raw.githubusercontent.com/azerothcore/$res/master/acore-module.json")
+
cd "$J_PATH_MODULES/$res/"
- branch=`git rev-parse --abbrev-ref HEAD`
- Joiner:upd_repo "https://github.com/azerothcore/$res" "$res" "$branch" && echo "Done, please re-run compiling and db assembly" || echo "Cannot update"
+ # use current branch if something wrong with json
+ if [[ "$v" == "none" || "$v" == "not-defined" ]]; then
+ b=`git rev-parse --abbrev-ref HEAD`
+ fi
+
+ Joiner:upd_repo "https://github.com/azerothcore/$res" "$res" "$b" && echo "Done, please re-run compiling and db assembly" || echo "Cannot update"
cd $_tmp
else
echo "Cannot update! Path doesn't exist"
@@ -184,16 +190,13 @@ function inst_module_remove {
function inst_simple_restarter {
echo "Running $1 in background..."
- bash "$AC_PATH_APPS/startup-scripts/simple-restarter" "$BINPATH" "$1" &
+ bash "$AC_PATH_APPS/startup-scripts/simple-restarter" "$AC_BINPATH_FULL" "$1" &
}
function inst_download_client_data {
- path="$BINPATH/data"
- if [ -e "$path/.git/" ]; then
- # if exists , update
- git --git-dir="$path/.git/" rev-parse && git --git-dir="$path/.git/" pull origin master | grep 'Already up-to-date.' && changed="no"
- else
- # otherwise clone
- git clone "https://github.com/wowgaming/client-data" -c advice.detachedHead=0 -b master --depth=1 $path
- fi
+ local path="$AC_BINPATH_FULL"
+
+ echo "Downloading client data in: $path/data.zip ..."
+ curl -L https://github.com/wowgaming/client-data/releases/download/v4/data.zip > "$path/data.zip" \
+ && unzip -o "$path/data.zip" -d "$path/" && rm "$path/data.zip"
} \ No newline at end of file
diff --git a/apps/startup-scripts/simple-restarter b/apps/startup-scripts/simple-restarter
index 084d1a1c92..47985fc121 100644
--- a/apps/startup-scripts/simple-restarter
+++ b/apps/startup-scripts/simple-restarter
@@ -1,9 +1,40 @@
+#!/usr/bin/env bash
+
#PARAMETER 1: directory
#PARAMETER 2: binary file
_bin_path=$1
_bin_file=$2
+
+_instant_crash_cnt=0
+_total_crashes=0
+
while true
do
+ if [ ! -f "$_bin_path/$_bin_file" ]; then
+ echo "$_bin_path/$_bin_file doesn't exists!"
+ exit 0
+ fi
+
+ STARTING_TIME=$(date +%s)
+
cd "$_bin_path" && "./$_bin_file" &>/dev/null; echo "$_bin_file crashed (?), restarting..."
+
+ ENDING_TIME=$(date +%s)
+ DIFFERENCE=$(( $ENDING_TIME - $STARTING_TIME ))
+
+ echo "Crashed after $DIFFERENCE seconds, total crashes: $_total_crashes"
+ ((_total_crashes++))
+
+ if [ $DIFFERENCE -lt 10 ]; then
+ # increment instant crash if runtime is lower than 10 seconds
+ ((_instant_crash_cnt++))
+ else
+ _instant_crash_cnt=0 # reset count
+ fi
+
+ if [ $_instant_crash_cnt -gt 5 ]; then
+ echo "Restarted exited. Infinite crash loop prevented. Please check your system"
+ exit 0
+ fi
done \ No newline at end of file
diff --git a/conf/config.sh.dist b/conf/config.sh.dist
index 3acc4f45c2..3157bafa17 100644
--- a/conf/config.sh.dist
+++ b/conf/config.sh.dist
@@ -1,4 +1,5 @@
# absolute root path of your azerothcore repository
+# It should not be modified if you don't really know what you're doing
SRCPATH="$AC_PATH_ROOT"
# absolute path where build files must be stored
@@ -8,7 +9,8 @@ BUILDPATH="$AC_PATH_ROOT/var/build/obj"
BINPATH="$AC_PATH_ROOT/env/dist"
# absolute path where config. files must be stored
-CONFDIR="$AC_PATH_ROOT/env/dist/etc/"
+# default: the system will use binpath by default
+# CONFDIR="$AC_PATH_ROOT/env/dist/etc/"
##############################################
#