Directory Structure [step 1]: moving files

working on #672

NOTE: This commit can't be compiled!!
This commit is contained in:
Yehonal
2017-10-12 20:00:52 +02:00
parent 4df28fd29c
commit f06f32849f
2508 changed files with 0 additions and 1325 deletions

View File

@@ -1,11 +0,0 @@
unamestr=`uname`
if [[ "$unamestr" == 'Darwin' ]]; then
AC_PATH_ROOT=$(greadlink -f "$AC_PATH_BIN/../")
else
AC_PATH_ROOT=$(readlink -f "$AC_PATH_BIN/../")
fi
AC_PATH_CONF="$AC_PATH_ROOT/conf"
AC_PATH_MODULES="$AC_PATH_ROOT/modules"

View File

@@ -1,35 +0,0 @@
[[ ${GUARDYVAR:-} -eq 1 ]] && return || readonly GUARDYVAR=1 # include it once
# force default language for applications
LC_ALL=C
AC_PATH_BIN="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
AC_PATH_SHARED="$AC_PATH_BIN/bash_shared"
source "$AC_PATH_SHARED/defines.sh"
source "$AC_PATH_MODULES/hw-core/bash-lib-event/src/hooks.sh"
function registerHooks() { hwc_event_register_hooks "$@"; }
function runHooks() { hwc_event_run_hooks "$@"; }
source "$AC_PATH_CONF/config.sh.dist" # "hack" to avoid missing conf variables
if [ -f "$AC_PATH_CONF/config.sh" ]; then
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
#
# Load modules
#
for entry in "$AC_PATH_MODULES/"*/include.sh
do
if [ -e $entry ]; then
source $entry
fi
done

View File

@@ -1,2 +0,0 @@
config.sh

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env bash
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
bash "$CURRENT_PATH/compiler.sh" 1

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env bash
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
bash "$CURRENT_PATH/compiler.sh" 2

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env bash
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
bash "$CURRENT_PATH/compiler.sh" 3

View File

@@ -1,32 +0,0 @@
## How to compile:
first of all, if you need some custom configuration you have to copy and rename
/conf/config.sh.dist in /conf/config.sh and configure it
* for a "clean" compilation you must run all scripts in their order:
./1-clean.sh
./2-configure.sh
./3-build.sh
* if you add/rename/delete some sources and you need to compile it you have to run:
./2-configure.sh
./3-build.sh
* if you have modified code only, you just need to run
./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:
For an optimal development process and **really faster** compilation time, is suggested to use clang instead of gcc

View File

@@ -1,44 +0,0 @@
#!/usr/bin/env bash
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_PATH/includes/includes.sh"
function all() {
comp_clean
comp_configure
comp_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=("comp_clean" "comp_configure" "comp_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

View File

@@ -1,7 +0,0 @@
# you can choose build type from cmd argument
if [ ! -z $1 ]
then
CCTYPE=$1
CCTYPE=${CCTYPE^} # capitalize first letter if it's not yet
fi

View File

@@ -1,57 +0,0 @@
function comp_clean() {
echo "Cleaning build files"
CWD=$(pwd)
cd $BUILDPATH
make -f Makefile clean
make clean
find -iname '*cmake*' -not -name CMakeLists.txt -exec rm -rf {} \+
cd $CWD
}
function comp_configure() {
CWD=$(pwd)
cd $BUILDPATH
echo "Build path: $BUILDPATH"
echo "DEBUG info: $CDEBUG"
echo "Compilation type: $CTYPE"
# -DCMAKE_BUILD_TYPE=$CCTYPE disable optimization "slow and huge amount of ram"
# -DWITH_COREDEBUG=$CDEBUG compiled with debug information
#-DSCRIPTS_COMMANDS=$CSCRIPTS -DSCRIPTS_CUSTOM=$CSCRIPTS -DSCRIPTS_EASTERNKINGDOMS=$CSCRIPTS -DSCRIPTS_EVENTS=$CSCRIPTS -DSCRIPTS_KALIMDOR=$CSCRIPTS \
#-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 \
-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
cd $CWD
runHooks "ON_AFTER_CONFIG"
}
function comp_build() {
[ $MTHREADS == 0 ] && MTHREADS=`grep -c ^processor /proc/cpuinfo` && MTHREADS=$(($MTHREADS + 2))
echo "Using $MTHREADS threads"
CWD=$(pwd)
cd $BUILDPATH
time make -j $MTHREADS
make -j $MTHREADS install
cd $CWD
runHooks "ON_AFTER_BUILD"
}

View File

@@ -1,23 +0,0 @@
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_PATH/../../bash_shared/includes.sh"
AC_PATH_COMPILER="$AC_PATH_BIN/compiler"
if [ -f "$AC_PATH_COMPILER/config.sh" ]; then
source "$AC_PATH_COMPILER/config.sh" # should overwrite previous
fi
function ac_on_after_build() {
# move the run engine
cp -rvf "$AC_PATH_MODULES/acore/startup-scripts/"* "$BINPATH"
}
registerHooks "ON_AFTER_BUILD" ac_on_after_build
source "$AC_PATH_COMPILER/includes/defines.sh"
source "$AC_PATH_COMPILER/includes/functions.sh"
mkdir -p $BUILDPATH
mkdir -p $BINPATH

View File

@@ -1,3 +0,0 @@
/output/
/backup/
config.sh

View File

@@ -1,16 +0,0 @@
## How to use:
First of all, if you need some custom configuration you have to copy and rename
/conf/config.sh.dist in /conf/config.sh and configure it
db_assembler.sh script contains an interactive menu to assemble and import sql files.
Just run it to display the options.
Note: You can even use actions directly by command lines specifying the option.
Ex:
./db_assembler.sh 1
It will start the assemble process of all sql files.

View File

@@ -1,61 +0,0 @@
#!/usr/bin/env bash
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_PATH/includes/includes.sh"
cmdopt=$1
while true
do
echo "===== DB ASSEMBLER MENU ====="
PS3='Please enter your choice: '
options=(
"Assemble ALL" "Assemble only bases" "Assemble only updates" "Assemble only customs"
"Quit"
"Assemble & import ALL" "Assemble & import only bases" "Assemble & import only updates" "Assemble & import only customs"
)
function _switch() {
case $1 in
"Assemble ALL")
dbasm_run true true true
;;
"Assemble only bases")
dbasm_run true false false
;;
"Assemble only updates")
dbasm_run false true false
;;
"Assemble only customs")
dbasm_run false false true
;;
"Assemble & import ALL")
dbasm_import true true true
;;
"Assemble & import only bases")
dbasm_import true false false
;;
"Assemble & import only updates")
dbasm_import false true false
;;
"Assemble & import only customs")
dbasm_import false false true
;;
"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

View File

@@ -1,348 +0,0 @@
# globals
PROMPT_USER=""
PROMPT_PASS=""
# use in a subshell
function dbasm_resetExitCode() {
exit 0
}
function dbasm_mysqlExec() {
confs=$1
command=$2
options=$3
eval $confs
if [[ ! -z "${PROMPT_USER// }" ]]; then
MYSQL_USER=$PROMPT_USER
MYSQL_PASS=$PROMPT_PASS
fi
export MYSQL_PWD=$MYSQL_PASS
retval=$("$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$MYSQL_USER" $options -e "$command")
if [[ $? -ne 0 ]]; then
err=$("$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$MYSQL_USER" $options -e "$command" 2>&1 )
if [[ "$err" == *"Access denied"* ]]; then
read -p "Insert mysql user:" PROMPT_USER
read -p "Insert mysql pass:" -s PROMPT_PASS
export MYSQL_PWD=$PROMPT_PASS
# create configured account if not exists
"$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$PROMPT_USER" $options -e "CREATE USER '${MYSQL_USER}'@'${MYSQL_HOST}' IDENTIFIED BY '${MYSQL_PASS}' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0;"
"$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$PROMPT_USER" $options -e "GRANT USAGE ON * . * TO '${MYSQL_USER}'@'${MYSQL_HOST}' WITH GRANT OPTION;"
retval=$("$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$PROMPT_USER" $options -e "$command")
else
exit
fi
fi
}
function dbasm_isNotEmpty() {
dbname=$1
conf=$2
dbasm_mysqlExec "$conf" "SELECT COUNT(DISTINCT table_name) FROM information_schema.columns WHERE table_schema = '${dbname}'" "--skip-column-names"
if (( $retval > 0 )); then
true
else
false
fi
}
function dbasm_dbExists() {
dbname=$1
conf=$2
dbasm_mysqlExec "$conf" "SHOW DATABASES LIKE '${dbname}'" "--skip-column-names"
if [ "$retval" == "${dbname}" ]; then
true
else
false
fi
}
function dbasm_createDB() {
database=${1,,}
uc=${database^^}
name="DB_"$uc"_CONF"
confs=${!name}
name="DB_"$uc"_NAME"
dbname=${!name}
eval $confs
CONF_USER=$MYSQL_USER
CONF_PASS=$MYSQL_PASS
if dbasm_dbExists $dbname "$confs"; then
echo "$dbname database exists"
else
echo "Creating DB ${dbname} ..."
dbasm_mysqlExec "$confs" "CREATE DATABASE \`${dbname}\`" ""
dbasm_mysqlExec "$confs" "GRANT ALL PRIVILEGES ON \`${dbname}\` . * TO '${CONF_USER}'@'${MYSQL_HOST}' WITH GRANT OPTION;"
fi
}
function dbasm_assemble() {
# to lowercase
database=${1,,}
start_sql=$2
with_base=$3
with_updates=$4
with_custom=$5
uc=${database^^}
name="DB_"$uc"_PATHS"
v="$name[@]"
base=("${!v}")
name="DB_"$uc"_UPDATE_PATHS"
v="$name[@]"
updates=("${!v}")
name='DB_'$uc'_CUSTOM_PATHS'
v="$name[@]"
custom=("${!v}")
suffix_base="_base"
suffix_upd="_update"
suffix_custom="_custom"
curTime=`date +%Y_%m_%d_%H_%M_%S`
if [ $with_base = true ]; then
echo "" > $OUTPUT_FOLDER$database$suffix_base".sql"
if [ ! ${#base[@]} -eq 0 ]; then
echo "Generating $OUTPUT_FOLDER$database$suffix_base ..."
for d in "${base[@]}"
do
echo "Searching on $d ..."
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
fi
if [ $with_updates = true ]; then
updFile=$OUTPUT_FOLDER$database$suffix_upd".sql"
echo "" > $updFile
if [ ! ${#updates[@]} -eq 0 ]; then
echo "Generating $OUTPUT_FOLDER$database$suffix_upd ..."
for d in "${updates[@]}"
do
echo "Searching on $d ..."
if [ ! -z $d ]; then
for entry in "$d"/*.sql "$d"/**/*.sql
do
if [[ ! -e $entry ]]; then
continue
fi
echo "-- $file" >> $updFile
cat "$entry" >> $updFile
done
fi
done
fi
fi
if [ $with_custom = true ]; then
custFile=$OUTPUT_FOLDER$database$suffix_custom".sql"
echo "" > $custFile
if [ ! ${#custom[@]} -eq 0 ]; then
echo "Generating $OUTPUT_FOLDER$database$suffix_custom ..."
for d in "${custom[@]}"
do
echo "Searching on $d ..."
if [ ! -z $d ]; then
for entry in "$d"/*.sql "$d"/**/*.sql
do
if [[ ! -e $entry ]]; then
continue
fi
echo "-- $file" >> $custFile
cat "$entry" >> $custFile
done
fi
done
fi
fi
}
function dbasm_run() {
echo "===== STARTING ASSEMBLY PROCESS ====="
mkdir -p "$OUTPUT_FOLDER"
for db in ${DATABASES[@]}
do
dbasm_assemble "$db" $version".sql" $1 $2 $3
done
echo "===== DONE ====="
}
function dbasm_db_backup() {
echo "backing up $1"
database=${1,,}
uc=${database^^}
name="DB_"$uc"_CONF"
confs=${!name}
name="DB_"$uc"_NAME"
dbname=${!name}
eval $confs;
if [[ ! -z "${PROMPT_USER// }" ]]; then
MYSQL_USER=$PROMPT_USER
MYSQL_PASS=$PROMPT_PASS
fi
export MYSQL_PWD=$MYSQL_PASS
now=`date +%s`
"$DB_MYSQL_DUMP_EXEC" --opt --user="$MYSQL_USER" --host="$MYSQL_HOST" "$dbname" > "${BACKUP_FOLDER}${database}_backup_${now}.sql" && echo "done"
if [[ $? -ne 0 ]]; then
err=$("$DB_MYSQL_DUMP_EXEC" --opt --user="$MYSQL_USER" --host="$MYSQL_HOST" "$dbname" 2>&1 )
if [[ "$err" == *"Access denied"* ]]; then
read -p "Insert mysql user:" PROMPT_USER
read -p "Insert mysql pass:" -s PROMPT_PASS
export MYSQL_PWD=$PROMPT_PASS
"$DB_MYSQL_DUMP_EXEC" --opt --user="$PROMPT_USER" --host="$MYSQL_HOST" "$dbname" > "${BACKUP_FOLDER}${database}_backup_${now}.sql" && echo "done"
else
exit
fi
fi
}
function dbasm_db_import() {
database=${1,,}
type=$2
uc=${database^^}
name="DB_"$uc"_CONF"
confs=${!name}
name="DB_"$uc"_NAME"
dbname=${!name}
if [[ $type = "base" && $DB_SKIP_BASE_IMPORT_IF_EXISTS = true ]]; then
if dbasm_isNotEmpty $dbname "$confs"; then
echo "$dbname is not empty, base importing skipped"
return
fi
fi
echo "importing $1 - $2 ..."
eval $confs;
if [[ ! -z "${PROMPT_USER// }" ]]; then
MYSQL_USER=$PROMPT_USER
MYSQL_PASS=$PROMPT_PASS
fi
export MYSQL_PWD=$MYSQL_PASS
"$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$MYSQL_USER" "$dbname" < "${OUTPUT_FOLDER}${database}_${type}.sql"
if [[ $? -ne 0 ]]; then
err=$("$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$MYSQL_USER" "$dbname" 2>&1 )
if [[ "$err" == *"Access denied"* ]]; then
read -p "Insert mysql user:" PROMPT_USER
read -p "Insert mysql pass:" -s PROMPT_PASS
export MYSQL_PWD=$PROMPT_PASS
"$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$PROMPT_USER" "$dbname" < "${OUTPUT_FOLDER}${database}_${type}.sql"
else
exit
fi
fi
}
function dbasm_import() {
dbasm_run $1 $2 $3
with_base=$1
with_updates=$2
with_custom=$3
echo "===== CHECKING DBs ====="
for db in ${DATABASES[@]}
do
dbasm_createDB "$db"
done
echo "===== DONE ====="
#
# BACKUP
#
if [ $BACKUP_ENABLE = true ]; then
echo "===== STARTING BACKUP PROCESS ====="
mkdir -p "$BACKUP_FOLDER"
for db in ${DATABASES[@]}
do
dbasm_db_backup "$db"
done
echo "===== DONE ====="
fi
echo "===== STARTING IMPORTING PROCESS ====="
#
# IMPORT
#
if [ $with_base = true ]; then
for db in ${DATABASES[@]}
do
dbasm_db_import "$db" "base"
done
fi
if [ $with_updates = true ]; then
for db in ${DATABASES[@]}
do
dbasm_db_import "$db" "update"
done
fi
if [ $with_custom = true ]; then
for db in ${DATABASES[@]}
do
dbasm_db_import "$db" "custom"
done
fi
echo "===== DONE ====="
}

View File

@@ -1,11 +0,0 @@
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_PATH/../../bash_shared/includes.sh"
AC_PATH_DBASSEMBLER="$AC_PATH_BIN/db_assembler"
if [ -f "$AC_PATH_DBASSEMBLER/config.sh" ]; then
source "$AC_PATH_DBASSEMBLER/config.sh" # should overwrite previous
fi
source "$AC_PATH_DBASSEMBLER/includes/functions.sh"

View File

@@ -1 +0,0 @@
config.sh

View File

@@ -1,12 +0,0 @@
This script is used by devs to export the databases to base directories
You should use it on clean databases
## USAGE
NOTE: this script is only working under unix currently
1) You must create a config.sh file changing DB connection configurations
of /conf/config.sh.dist
2) Run the db_export.sh script and wait

View File

@@ -1,45 +0,0 @@
#!/usr/bin/env bash
ROOTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../" && pwd )"
source $ROOTPATH"/bin/bash_shared/includes.sh"
if [ -f "./config.sh" ]; then
source "./config.sh" # should overwrite previous
fi
echo "===== STARTING PROCESS ====="
function export() {
echo "Working on: "$1
database=$1
var_base_path="DB_"$database"_PATHS"
base_path=${!var_base_path}
base_conf="TPATH="$base_path";\
CLEANFOLDER=1; \
CHMODE=0; \
TEXTDUMPS=0; \
PARSEDUMP=1; \
FULL=0; \
DUMPOPTS='--skip-comments --skip-set-charset --routines --extended-insert --order-by-primary --single-transaction --quick'; \
"
var_base_conf="DB_"$database"_CONF"
base_conf=$base_conf${!var_base_conf}
var_base_name="DB_"$database"_NAME"
base_name=${!var_base_name}
bash $AC_PATH_MODULES"/drassil/mysql-tools/mysql-tools" dump "" $base_name "" "$base_conf"
}
for db in ${DATABASES[@]}
do
export "$db"
done
echo "===== DONE ====="

View File

@@ -1,114 +0,0 @@
#!/usr/bin/env bash
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_PATH/../bash_shared/includes.sh"
UPDATES_PATH="$AC_PATH_ROOT/data/sql/updates/"
function import() {
db=$1
folder="db_"$db
pendingPath="$AC_PATH_ROOT/data/sql/updates/pending_$folder"
updPath="$UPDATES_PATH/$folder"
latestUpd=`ls -1 $updPath/ | tail -n 1`
if [ -z $latestUpd ]; then
echo "FIRST UPDATE FILE MISSING!! DID YOU ARCHIVED IT?";
exit;
fi
dateToday=`date +%Y_%m_%d`
counter=0
dateLast=$latestUpd
tmp=${dateLast#*_*_*_}
oldCnt=${tmp%.sql}
oldDate=${dateLast%_$tmp}
if [ "$oldDate" = "$dateToday" ]; then
((counter=$oldCnt+1))
fi;
for entry in "$pendingPath"/*.sql
do
if [[ -e $entry ]]; then
oldVer=$oldDate"_"$oldCnt
cnt=$(printf -v counter "%02d" $counter ; echo $counter)
newVer=$dateToday"_"$cnt
startTransaction="START TRANSACTION;";
updHeader="ALTER TABLE version_db_"$db" CHANGE COLUMN "$oldVer" "$newVer" bit;";
endTransaction="COMMIT;";
newFile="$updPath/"$dateToday"_"$cnt".sql"
oldFile=$(basename "$entry")
prefix=${oldFile%_*.sql}
suffix=${oldFile#rev_}
rev=${suffix%.sql}
isRev=0
if [[ $prefix = "rev" && $rev =~ ^-?[0-9]+$ ]]; then
isRev=1
fi
echo "-- DB update $oldVer -> $newVer" > "$newFile";
if [[ $isRev -eq 1 ]]; then
echo "DROP PROCEDURE IF EXISTS \`updateDb\`;" >> "$newFile";
echo "DELIMITER //" >> "$newFile";
echo "CREATE PROCEDURE updateDb ()" >> "$newFile";
echo "proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE';" >> "$newFile";
echo "SELECT COUNT(*) INTO @COLEXISTS" >> "$newFile";
echo "FROM information_schema.COLUMNS" >> "$newFile";
echo "WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_"$db"' AND COLUMN_NAME = '"$oldVer"';" >> "$newFile";
echo "IF @COLEXISTS = 0 THEN LEAVE proc; END IF;" >> "$newFile";
fi
echo "$startTransaction" >> "$newFile";
echo "$updHeader" >> "$newFile";
if [[ $isRev -eq 1 ]]; then
echo "SELECT sql_rev INTO OK FROM version_db_"$db" WHERE sql_rev = '$rev'; IF OK <> 'FALSE' THEN LEAVE proc; END IF;" >> "$newFile";
fi;
echo "--" >> "$newFile";
echo "-- START UPDATING QUERIES" >> "$newFile";
echo "--" >> "$newFile";
cat $entry >> "$newFile";
echo "--" >> "$newFile";
echo "-- END UPDATING QUERIES" >> "$newFile";
echo "--" >> "$newFile";
echo "$endTransaction" >> "$newFile";
if [[ $isRev -eq 1 ]]; then
echo "END;" >> "$newFile";
echo "//" >> "$newFile";
echo "DELIMITER ;" >> "$newFile";
echo "CALL updateDb();" >> "$newFile";
echo "DROP PROCEDURE IF EXISTS \`updateDb\`;" >> "$newFile";
fi;
rm $entry;
oldDate=$dateToday
oldCnt=$cnt
((counter+=1))
fi
done
}
import "world"
import "characters"
import "auth"
echo "Done."

View File

@@ -1,117 +0,0 @@
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*)
# If available, use LSB to identify distribution
if [ -f /etc/lsb-release -o -d /etc/lsb-release.d ]; then
DISTRO=$(lsb_release -i | cut -d: -f2 | sed s/'^\t'//)
# Otherwise, use release info file
else
DISTRO=$(ls -d /etc/[A-Za-z]*[_-][rv]e[lr]* | grep -v "lsb" | cut -d'/' -f3 | cut -d'-' -f1 | cut -d'_' -f1)
fi
DISTRO=${DISTRO,,}
# TODO: implement different configurations by distro
source "$AC_PATH_INSTALLER/includes/os_configs/$DISTRO.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() {
cd "$AC_PATH_ROOT"
git pull origin $(git rev-parse --abbrev-ref HEAD)
}
function inst_resetRepo() {
cd "$AC_PATH_ROOT"
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" "$AC_PATH_ROOT/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 "$AC_PATH_ROOT/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 "$AC_PATH_ROOT/modules/$res" && echo "Done"
echo "";
echo "";
}

View File

@@ -1,14 +0,0 @@
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"

View File

@@ -1,5 +0,0 @@
sudo apt-get install -y git cmake make gcc g++ clang libmysqlclient-dev \
libssl1.0-dev libbz2-dev libreadline-dev libncurses-dev \
mysql-server libace-6.* libace-dev

View File

@@ -1,6 +0,0 @@
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

View File

@@ -1,5 +0,0 @@
sudo apt-get install -y git cmake make gcc g++ clang libmysqlclient-dev \
libssl-dev=1.0.2g-1ubuntu4.8 libbz2-dev libreadline-dev libncurses-dev \
mysql-server libace-6.* libace-dev

View File

@@ -1,17 +0,0 @@
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"

View File

@@ -1,77 +0,0 @@
#!/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