Various fixes to acore dashboard

+ simple restarter now prevents infinite crash loops
+ client data downloader now uses github releases and fixed downloading path
+ module updating now take care about compatibility version info
+ disabled CONFDIR variable in bash conf file, using BINPATH by default instead
This commit is contained in:
Yehonal
2018-07-17 13:54:23 +02:00
parent 113ac06929
commit af5256cd5b
5 changed files with 59 additions and 16 deletions

View File

@@ -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"

View File

@@ -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

View File

@@ -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
cd "$J_PATH_MODULES/$res/"
branch=`git rev-parse --abbrev-ref HEAD`
read v b < <(inst_getVersionBranch "https://raw.githubusercontent.com/azerothcore/$res/master/acore-module.json")
Joiner:upd_repo "https://github.com/azerothcore/$res" "$res" "$branch" && echo "Done, please re-run compiling and db assembly" || echo "Cannot update"
cd "$J_PATH_MODULES/$res/"
# 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"
}

View File

@@ -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

View File

@@ -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/"
##############################################
#