-
-
Save SkirnirMaNGOS/4012449 to your computer and use it in GitHub Desktop.
importer.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
RELEASE="63" | |
fileDir="$(pwd)" | |
homeDir="/home/<user>/Source" | |
mangosDir="$homeDir/cmangos" | |
ytdbDir="$homeDir/ytdbase/Wotlk" | |
ytdbCur="$ytdbDir/R$RELEASE" | |
mangosSql="$mangosDir/sql/updates" | |
acid="$homeDir/acid" | |
sd2Sql="$homeDir/scriptdev2/sql/updates" | |
hostname=127.0.0.1 | |
username=mangos | |
userpass=mangos | |
userport=3306 | |
databasename=mangos-ytdb | |
databasenamesd2=mangos-scriptdev2 | |
custom="$homeDir/custom" | |
# fetch from YTDB release MaNGOS revision | |
cd $ytdbCur | |
rm *.sql | |
ytdb_files=$(ls -R) | |
ytdb_mangos=$(echo "${ytdb_files}"| grep MaNGOS) | |
ytdb_mangos_rev=$(echo ${ytdb_mangos} | awk -F "_" '{print $5}') | |
7z x YTDB_*.7z | |
ytdb_mangos_rev_id=$(echo $ytdb_mangos_rev | sed 's/R//') | |
ytdb_mangos_sql=$(ls YTDB*MaNGOS*.sql) | |
ytdb_final_ytdbfull=$(echo ${ytdb_mangos_sql} | sed -e "s/^/mysql --host=$hostname --user=$username --password=$userpass --port=$userport $databasename < /") | |
# create head for ytdb.sh | |
ytdb_final_ytdb_head=$(echo ${ytdb_final_ytdbfull}| sed '/MaNGOS/ { | |
i\'#!/bin/bash' | |
i\cd '$ytdbCur' | |
a\cd '$mangosSql' | |
}') | |
echo "$ytdb_mangos_rev_id YTDB starting revision | |
-- collecting ytdb Updates" | |
ytdb_ytdbupdates=$(echo "$ytdb_files" | grep updatepack_mangos) | |
# fetch revision number this updatepack was created for | |
# add it: $revisionnumber $filename | |
# afterwards delete the revision number from the updatepacks | |
ytdb_mangos_updates=$(echo "$ytdb_files" | grep updatepack_mangos | sed 's/\(.*\)\..*/\1/;s|(||g; s|)||g') | |
ytdb_mangos_updates_rev=$(echo "$ytdb_mangos_updates" | awk -F"_" '{ print $4}') | |
ytdb_pasted=$(paste -d" " <(echo $ytdb_mangos_updates_rev | xargs -n1) <(echo $ytdb_ytdbupdates | xargs -n1)) | |
# bash does not read ( and ) so change it to \( and \) | |
ytdb_pasted_escape=$(echo "$ytdb_pasted" | sed 's|(|\\\(|g;s|)|\\\)|g') | |
echo "-- collecting MaNGOS Updates" | |
cd $mangosSql | |
# mangos_old required due to unexpected release | |
# ToDo: (hardcoded 0.17) // wait for YTDB R64 | |
mangos_old_updates=$(ls -d -1 0.17/*mangos* | awk -F"/" '{ print $2 }' |awk ' $1> '$ytdb_mangos_rev_id'') | |
mangos_old_updates_rev=$(echo "$mangos_old_updates" | awk -F"_" '{ print $1 "_" $2 }') | |
mangos_old_updates=$(echo "$mangos_old_updates" | sed 's/^/0.17\//g') | |
mangos_old_pasted=$(paste -d" " <(echo $mangos_old_updates_rev | xargs -n1) <(echo $mangos_old_updates | xargs -n1)) | |
mangos_updates=$(ls *mangos* | awk ' $1 > '$ytdb_mangos_rev_id'') | |
# combine MaNGOS updates and YTDB updates and sort their order of appearance | |
mangosytdb_updates=$(echo -e "$ytdb_pasted_escape""\n""$mangos_old_pasted""\n""$mangos_updates") | |
# remove empty line, if no ytdb updates are possible | |
mangosytdb_updates_clean=$(echo -e "$mangosytdb_updates" | awk 'NF' ) | |
mangosytdb_updates_sorted=$(echo "$mangosytdb_updates_clean" | sort -n) | |
mangosytdb_sorted=$(echo "$mangosytdb_updates_sorted" | cut -d " " -f2) | |
# add mysql command and add a line where to cd for and after importing this file | |
mangosytdb_updates_mysql=$(echo "$mangosytdb_sorted" | sed -e "s/^/mysql --host=$hostname --user=$username --password=$userpass --port=$userport $databasename < /") | |
mangosytdb_updates_final=$(echo "$mangosytdb_updates_mysql" | sed '/updatepack_mangos_/ { | |
i\ cd '$ytdbCur'/Updates | |
a\ cd '$mangosSql' | |
}') | |
sd2_rev=$(echo "$ytdb_mangos" | awk -F "_" '{print $7}') | |
sd2_rev_id=$(echo "$sd2_rev" |sed 's/R//') | |
echo "$sd2_rev_id ScriptDev2 starting revision" | |
echo "-- collecting ScriptDev2 Updates" | |
# fetch revision number this updatepack was created for | |
# add it: $revisionnumber $filename | |
# afterwards delete the revision number from the updatepacks | |
cd $sd2Sql | |
# sd2_old required due to unexpected release | |
sd2_old_files=$(ls -d -1 0.6/*mangos*) | |
sd2_old_updates=$(echo "$sd2_old_files" | awk -F"_" '{ print $1}' | awk -F"/" '{ print $2}') | |
sd2_old_updates_rev=$(echo "$sd2_old_updates" | sed 's/r//') | |
sd2_old_pasted=$(paste -d " " <(echo $sd2_old_updates_rev | xargs -n1) <(echo $sd2_old_files | xargs -n1)) | |
sd2_files=$(ls *mangos*) | |
sd2_updates=$(echo "$sd2_files" | awk -F"_" '{ print $1}') | |
sd2_updates_rev=$(echo "$sd2_updates" | sed 's/r//') | |
sd2_pasted=$(paste -d " " <(echo $sd2_updates_rev | xargs -n1) <(echo $sd2_files | xargs -n1)) | |
sd2_pasted=$(echo -e "$sd2_old_pasted""\n""$sd2_pasted") | |
sd2_pasted_clean=$(echo "$sd2_pasted" | awk ' $1 > '$sd2_rev_id'') | |
sd2_pasted_final=$(echo "$sd2_pasted_clean" | cut -d " " -f2) | |
# add mysql command and add a head line where to cd for importing this file | |
# since SD2 is independet from YTDB updates, this only needs to be done once | |
sd2_cd=$(echo "cd $sd2Sql") | |
sd2_final=$(echo "$sd2_pasted_final" | sed -e "s/^/mysql --host=$hostname --user=$username --password=$userpass --port=$userport $databasename < /") | |
sd2_mangos_updates=$(echo -e "$sd2_cd""\n""$sd2_final") | |
# add SD2 full scripts file | |
sd2_full=$(echo "cd $sd2Sql/../ | |
mysql --host=$hostname --user=$username --password=$userpass --port=$userport $databasenamesd2 < scriptdev2_script_full.sql") | |
# ACID and ytdb EventAI import | |
echo "-- collecting ACID Updates" | |
# ACID | |
acid_cd=$(echo "cd $acid") | |
cd $acid | |
acid_sql=$(ls acid_wotlk.sql) | |
acid_mysql=$(echo "$acid_sql" | sed -e "s/^/mysql --host=$hostname --user=$username --password=$userpass --port=$userport $databasename < /") | |
acid_final=$(echo -e "$acid_cd""\n""$acid_mysql") | |
# add custom files with path where to find them and mysql command | |
echo "-- collecting Custom Files" | |
custom_cd=$(echo "cd $custom") | |
cd $custom | |
custom_ls=$(ls) | |
custom_mysql=$(echo "$custom_ls" | sed -e "s/^/mysql --host=$hostname --user=$username --password=$userpass --port=$userport $databasename < /") | |
custom_final=$(echo -e "$custom_cd""\n""$custom_mysql") | |
echo "-- generate Output File. ${fileDir}/ytdb.sh | |
-- chmod 755 that file and run it" | |
echo -e "$ytdb_final_ytdb_head""\n""$mangosytdb_updates_final""\n""$sd2_mangos_updates""\n""$sd2_full""\n""$acid_final""\n""$custom_final" > $fileDir/ytdb.sh | |
echo "done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd /home/<user>/Source/ytdbase/Wotlk/R63 | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < YTDB_0.14.6_R630_MaNGOS_R12214_SD2_R2737_ACID_R310_RuDB_R56.sql | |
cd /home/<user>/Source/cmangos/sql/updates | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.17/12233_01_mangos_mangos_string.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.17/12235_01_mangos_mangos_string.sql | |
cd /home/<user>/Source/ytdbase/Wotlk/R63/Updates | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 631_updatepack_mangos_\(12247\).sql | |
cd /home/<user>/Source/cmangos/sql/updates | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.17/12258_01_mangos_mangos_string.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.17/12268_01_mangos_dbscripts.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.17/12269_01_mangos_creature_loot_template.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.17/12269_02_mangos_gameobject_loot_template.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.17/12269_03_mangos_fishing_loot_template.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.17/12269_04_mangos_reference_loot_template.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.17/12269_05_mangos_skinning_loot_template.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.17/12269_06_mangos_item_loot_template.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.17/12269_07_mangos_disenchant_loot_template.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.17/12269_08_mangos_milling_loot_template.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.17/12269_09_mangos_spell_loot_template.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.17/12269_10_mangos_prospecting_loot_template.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.17/12269_11_mangos_mail_loot_template.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.17/12269_12_mangos_pickpocketing_loot_template.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.17/12269_13_mangos_gossip_menu.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.17/12269_14_mangos_gossip_menu_option.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 12278_01_mangos_creature_template.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 12279_01_mangos_creature_template.sql | |
cd /home/<user>/Source/scriptdev2/sql/updates | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.6/r2742_mangos.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.6/r2743_mangos.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.6/r2745_mangos.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.6/r2749_mangos.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < 0.6/r2752_mangos.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < r2756_mangos.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < r2757_mangos.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < r2758_mangos.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < r2761_mangos.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < r2763_mangos.sql | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < r2766_mangos.sql | |
cd /home/<user>/Source/scriptdev2/sql/updates/../ | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-scriptdev2 < scriptdev2_script_full.sql | |
cd /home/<user>/Source/acid | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < acid_wotlk.sql | |
cd /home/<user>/Source/custom | |
mysql --host=127.0.0.1 --user=mangos --password=mangos --port=3306 mangos-ytdb < ironforge_ah.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment