Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- RELEASE="57"
- mangosDir="/home/[user]/source/mangos"
- ytdbDir="/home/[user]/source/ytdbase"
- ytdbCur="$ytdbDir/R$RELEASE"
- mangosSql="$mangosDir/sql/updates"
- sd2Sql="/home/[user]/source/scriptdev2/sql/Updates"
- hostname=127.0.0.1
- username=mangos
- userpass=mangos
- userport=3306
- databasename=mangos
- databasenamesd2=scriptdev2
- custom="/home/[user]/source/custom"
- # fetch from YTDB release MaNGOS revision
- cd $ytdbCur
- rm *.sql
- ls -R > /tmp/files.txt
- grep MaNGOS /tmp/files.txt > /tmp/f1a.txt
- awk -F "_" '{print $5}' /tmp/f1a.txt > /tmp/f1b.txt
- 7z x YTDB_*.7z
- sed 's/R//' /tmp/f1b.txt > /tmp/f1c.txt
- ls *MaNGOS*sql* > /tmp/f1d.txt
- sed -e "s/^/mysql --host=$hostname --user=$username --password=$userpass --port=$userport $databasename < /" /tmp/f1d.txt > /tmp/f1e.txt
- # create head for ytdb.sh
- sed '/MaNGOS/ {
- i\'#!/bin/bash'
- i\ cd '$ytdbCur'
- a\ cd '$mangosSql'
- }' /tmp/f1e.txt > /tmp/f1.txt
- ytdbRev="$(head /tmp/f1c.txt)"
- echo "$ytdbRev YTDB starting revision
- -- collecting ytdb Updates"
- cat /tmp/files.txt | grep mangos_FIX > /tmp/f2a.txt
- # bash does not read ( and ) so change it to \( and \)
- sed 's|(|\\\(|g;s|)|\\\)|g' /tmp/f2a.txt > /tmp/f2a1.txt
- # fetch revision number this updatepack was created for
- # add it: $revisionnumber $filename
- # afterwards delete the revision number from the updatepacks
- grep mangos_FIX /tmp/files.txt | sed 's/\(.*\)\..*/\1/;s|(||g; s|)||g' > /tmp/f2.txt
- awk -F"_" '{ print $4}' /tmp/f2.txt > /tmp/f2b.txt
- paste -d " " /tmp/f2b.txt /tmp/f2a1.txt > /tmp/f2.txt
- echo "-- collecting MaNGOS Updates"
- cd $mangosSql
- ls *mangos* | awk ' $1 > '$ytdbRev'' > /tmp/mangosUpdates.txt
- # combine MaNGOS updates and YTDB updates and sort their order of appearance
- cat /tmp/mangosUpdates.txt /tmp/f2.txt > /tmp/f3a.txt
- sort -n /tmp/f3a.txt > /tmp/f3b.txt
- cut -d " " -f2 /tmp/f3b.txt > /tmp/f3.txt
- # add mysql command and add a line where to cd for and after importing this file
- sed -e "s/^/mysql --host=$hostname --user=$username --password=$userpass --port=$userport $databasename < /" /tmp/f3.txt > /tmp/f4a.txt
- sed '/mangos_FIX/ {
- i\ cd '$ytdbCur'/Updates
- a\ cd '$mangosSql'
- }' /tmp/f4a.txt > /tmp/f4.txt
- echo "-- collecting ScriptDev2 Updates"
- awk -F "_" '{print $7}' /tmp/f1a.txt > /tmp/f5a.txt
- sed 's/R//' /tmp/f5a.txt > /tmp/f5b.txt
- sd2Rev="$(head /tmp/f5b.txt)"
- # fetch revision number this updatepack was created for
- # add it: $revisionnumber $filename
- # afterwards delete the revision number from the updatepacks
- cd $sd2Sql
- echo "$sd2Rev ScriptDev2 starting revision"
- ls *mangos* > /tmp/files2.txt
- awk -F"_" '{ print $1}' /tmp/files2.txt > /tmp/f5b2.txt
- sed 's/r//' /tmp/f5b2.txt > /tmp/f5b3.txt
- paste -d " " /tmp/f5b3.txt /tmp/files2.txt > /tmp/f5b4.txt
- awk ' $1 > '$sd2Rev'' /tmp/f5b4.txt > /tmp/f5c.txt
- cut -d " " -f2 /tmp/f5c.txt > /tmp/f5c1.txt
- # 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
- echo " cd $sd2Sql" > /tmp/f5d.txt
- sed -e "s/^/mysql --host=$hostname --user=$username --password=$userpass --port=$userport $databasename < /" /tmp/f5c1.txt > /tmp/f5e.txt
- cat /tmp/f5d.txt /tmp/f5e.txt > /tmp/f5.txt
- # add SD2 full scripts file
- echo " cd $sd2Sql/../
- mysql --host=$hostname --user=$username --password=$userpass --port=$userport $databasenamesd2 < scriptdev2_script_full.sql" > /tmp/f6.txt
- # add custom files with path where to find them and mysql command
- echo " cd $custom" > /tmp/f7a.txt
- cd $custom
- ls > /tmp/f7b.txt
- sed -e "s/^/mysql --host=$hostname --user=$username --password=$userpass --port=$userport $databasename < /" /tmp/f7b.txt > /tmp/f7c.txt
- cat /tmp/f7a.txt /tmp/f7c.txt > /tmp/f7.txt
- echo "-- generate Output File. chmod 755 that file and run it"
- cat /tmp/f1.txt /tmp/f4.txt /tmp/f5.txt /tmp/f6.txt /tmp/f7.txt> /home/[user]/Desktop/ytdb.sh
- cd /tmp/
- rm f1a.txt f1b.txt f1c.txt f1d.txt f1e.txt f1.txt f2a1.txt f2a.txt f2b.txt f2.txt f3a.txt f3b.txt f3.txt f4a.txt f4.txt f5a.txt f5b2.txt f5b3.txt f5b4.txt f5b.txt f5c1.txt f5c.txt f5d.txt f5e.txt f5.txt f6.txt f7a.txt f7b.txt f7c.txt f7.txt files2.txt files.txt mangosUpdates.txt
- echo "-- done"
Add Comment
Please, Sign In to add comment