diff --git a/bin/compiler/1-clean.sh b/bin/compiler/1-clean.sh index fc27e2bed..558c093e3 100755 --- a/bin/compiler/1-clean.sh +++ b/bin/compiler/1-clean.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" diff --git a/bin/compiler/2-configure.sh b/bin/compiler/2-configure.sh index 9c610576c..0d59b1caa 100755 --- a/bin/compiler/2-configure.sh +++ b/bin/compiler/2-configure.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" diff --git a/bin/compiler/3-build.sh b/bin/compiler/3-build.sh index 126da69cf..6956f82fd 100755 --- a/bin/compiler/3-build.sh +++ b/bin/compiler/3-build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" diff --git a/bin/compiler/compiler.sh b/bin/compiler/compiler.sh index 187a16ed1..f813be803 100755 --- a/bin/compiler/compiler.sh +++ b/bin/compiler/compiler.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#!/usr/bin/env bash + CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source "$CURRENT_PATH/includes/includes.sh" diff --git a/bin/compiler/includes/defines.sh b/bin/compiler/includes/defines.sh index e8324e92c..b60a59108 100644 --- a/bin/compiler/includes/defines.sh +++ b/bin/compiler/includes/defines.sh @@ -1,5 +1,3 @@ -#!/bin/bash - # you can choose build type from cmd argument if [ ! -z $1 ] then diff --git a/bin/db_assembler/db_assembler.sh b/bin/db_assembler/db_assembler.sh index 1d4e9d111..ebf6dbc2a 100755 --- a/bin/db_assembler/db_assembler.sh +++ b/bin/db_assembler/db_assembler.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + unamestr=`uname` if [[ "$unamestr" == 'Darwin' ]]; then SRCPATH=$(greadlink -f "../../") diff --git a/bin/db_exporter/db_export.sh b/bin/db_exporter/db_export.sh index e419d38bf..22d73f728 100755 --- a/bin/db_exporter/db_export.sh +++ b/bin/db_exporter/db_export.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash ROOTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../" && pwd )" diff --git a/bin/db_pendings/import.sh b/bin/db_pendings/import.sh index 95bce984c..e0497bf54 100755 --- a/bin/db_pendings/import.sh +++ b/bin/db_pendings/import.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" @@ -12,37 +12,46 @@ function import() { folder="db_"$1 pendingPath="$AC_PATH_ROOT/data/sql/updates/pending_$folder" updPath="$UPDATES_PATH/$folder" - + latestUpd=`ls $updPath/ -1 | 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 + startTransaction="START TRANSACTION;"; updHeader="ALTER TABLE db_version CHANGE COLUMN "$latestUpd" "$dateToday"_"$counter" bit;"; + endTransaction="COMMIT;"; + cnt=$(printf -v counter "%02d" $counter ; echo $counter) newFile="$updPath/"$dateToday"_"$cnt".sql" - echo "$updHeader" > "$newFile" + + echo "$startTransaction" > "$newFile" + echo "$updHeader" >> "$newFile" echo "--" >> "$newFile" echo "--" >> "$newFile" + cat $entry >> "$newFile" + echo "$endTransaction" >> "$newFile" + rm $entry + ((counter+=1)) fi done diff --git a/bin/runners/starter b/bin/runners/starter index 675bb13fb..1b87b5da6 100755 --- a/bin/runners/starter +++ b/bin/runners/starter @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash GDB_FILE="$2" CONFIG="$3" diff --git a/conf/config.sh.dist b/conf/config.sh.dist index 43f273e5d..0e949e042 100644 --- a/conf/config.sh.dist +++ b/conf/config.sh.dist @@ -1,5 +1,3 @@ -#!/bin/bash - # absolute root path of your azerothshard repository SRCPATH="$AC_PATH_ROOT" # absolute path where binary files must be stored diff --git a/data/sql/updates/README.md b/data/sql/updates/README.md index cf6ca2403..104608c57 100644 --- a/data/sql/updates/README.md +++ b/data/sql/updates/README.md @@ -1,3 +1,2 @@ Please read [this](https://github.com/azerothcore/azerothcore-wotlk/wiki/Dealing-with-SQL-files) before adding new SQL-update files. -Use template sql files present in this folder to build your update file diff --git a/data/sql/updates/pending_db_auth/template_for_auth_updates.txt b/data/sql/updates/pending_db_auth/template_for_auth_updates.txt deleted file mode 100644 index cea4ff0fe..000000000 --- a/data/sql/updates/pending_db_auth/template_for_auth_updates.txt +++ /dev/null @@ -1,38 +0,0 @@ -DROP PROCEDURE IF EXISTS `updateDb`; -DELIMITER // -CREATE PROCEDURE updateDb () -proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT "FALSE"; - --- ############################### --- CHANGE FOLLOWING VARIABLES --- ############################### - --- fill new_version with result of this bash command: date +%s%N --- you must run it for each sql updates -SET @new_version=""; --- set previous required version, or do not touch it if you are not sure -SET @req_version=NULL; - --- ############################### --- DO NOT CHANGE IT --- ############################### -SELECT sql_rev INTO OK FROM version_db_auth WHERE sql_rev = @new_version; IF OK <> "FALSE" THEN LEAVE proc; END IF; START TRANSACTION; INSERT INTO version_db_auth VALUES(@new_version,@req_version,NULL); - --- ############################### --- INSERT YOUR SQL QUERIES HERE --- ############################### - - - - --- ############################### --- TERMINATE YOUR SQL QUERIES HERE --- ############################### - -COMMIT; -END; -// -DELIMITER ; -CALL updateDb(); -DROP PROCEDURE IF EXISTS `updateDb`; - diff --git a/data/sql/updates/pending_db_characters/template_for_characters_updates.txt b/data/sql/updates/pending_db_characters/template_for_characters_updates.txt deleted file mode 100644 index a73dc8a58..000000000 --- a/data/sql/updates/pending_db_characters/template_for_characters_updates.txt +++ /dev/null @@ -1,38 +0,0 @@ -DROP PROCEDURE IF EXISTS `updateDb`; -DELIMITER // -CREATE PROCEDURE updateDb () -proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT "FALSE"; - --- ############################### --- CHANGE FOLLOWING VARIABLES --- ############################### - --- fill new_version with result of this bash command: date +%s%N --- you must run it for each sql updates -SET @new_version=""; --- set previous required version, or do not touch it if you are not sure -SET @req_version=NULL; - --- ############################### --- DO NOT CHANGE IT --- ############################### -SELECT sql_rev INTO OK FROM version_db_characters WHERE sql_rev = @new_version; IF OK <> "FALSE" THEN LEAVE proc; END IF; START TRANSACTION; INSERT INTO version_db_characters VALUES(@new_version,@req_version,NULL); - --- ############################### --- INSERT YOUR SQL QUERIES HERE --- ############################### - - - - --- ############################### --- TERMINATE YOUR SQL QUERIES HERE --- ############################### - -COMMIT; -END; -// -DELIMITER ; -CALL updateDb(); -DROP PROCEDURE IF EXISTS `updateDb`; - diff --git a/data/sql/updates/pending_db_world/template_for_world_updates.txt b/data/sql/updates/pending_db_world/template_for_world_updates.txt deleted file mode 100644 index 5872681ff..000000000 --- a/data/sql/updates/pending_db_world/template_for_world_updates.txt +++ /dev/null @@ -1,38 +0,0 @@ -DROP PROCEDURE IF EXISTS `updateDb`; -DELIMITER // -CREATE PROCEDURE updateDb () -proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT "FALSE"; - --- ############################### --- CHANGE FOLLOWING VARIABLES --- ############################### - --- fill new_version with result of this bash command: date +%s%N --- you must run it for each sql updates -SET @new_version=""; --- set previous required version, or do not touch it if you are not sure -SET @req_version=NULL; - --- ############################### --- DO NOT CHANGE IT --- ############################### -SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = @new_version; IF OK <> "FALSE" THEN LEAVE proc; END IF; START TRANSACTION; INSERT INTO version_db_world VALUES(@new_version,@req_version,NULL); - --- ############################### --- INSERT YOUR SQL QUERIES HERE --- ############################### - - - - --- ############################### --- TERMINATE YOUR SQL QUERIES HERE --- ############################### - -COMMIT; -END; -// -DELIMITER ; -CALL updateDb(); -DROP PROCEDURE IF EXISTS `updateDb`; - diff --git a/install.sh b/install.sh index a5ab4396d..3f06dfa0a 100755 --- a/install.sh +++ b/install.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" PATH_MODULES="$CUR_PATH/modules/"