yes. Those files are the updates from last update to the current one.
I don’t maked a script to insert on DB for many reason’s… I like to do that manually to check if there is any import errors.
yes. Those files are the updates from last update to the current one.
I don’t maked a script to insert on DB for many reason’s… I like to do that manually to check if there is any import errors.
Athena,
I believe I’ve found a glitch in the code at Step 8 of 8 - Compile SQL files.
The code
getdate=$(date --date="$lastrevdate" -d "+"$Counter" day" +"%F")
should return the date +1day (cause the $Counter equals 1) from the last TC revision ($lastrevdate) but it returns +1day from the current date.
To justify my assumption, I execute the following command at a prompt
date --date=2011-08-20 -d +1day +%F
which should return 2011-08-21 but instead it returns 2011-09-01 (cause today it’s 2011-08-31)
Or am I missing something?
I’m on Ubuntu 10.04 BTW.
EDIT: I’ve found this thread which might help http://www.unix.com/shell-programming-scripting/101637-adding-days-input-date-2.html
I’ll check their code later on cause I’m on the run right now…
I managed to get the code working, so it correctly finds the sql updates since previous Trinity update and creates the world_updates.sql, character_updates.sql and auth_updates.sql, to be manually inserted into the DB later on.
I’m posting only the part of the code that I have changed…
# The following functions convert the given date from and to Unix Epoch time (http://en.wikipedia.org/wiki/Unix_time)
# I use them to convert a date to Unix time, add the days I want (in seconds) and convert back to YYYY-MM-DD date
date2stamp () {
date --utc --date "$1" +%s
}
stamp2date (){
date --utc --date "1970-01-01 $1 sec" "+%Y-%m-%d"
}
echo "+------------------------------------------------------------------------------+"
echo "| Starting Step 8 of 8. |"
echo "| Going to compile SQL files since last build. |"
echo "| |"
if [ ${PAUSE_MODE} = 1 ]; then
echo "| Press a key to continue or CTRL+C to exit |"
echo "| (To disable pause, go to config and change PAUSE_MODE to 0) |"
echo "| |"
fi
echo "+------------------------------------------------------------------------------+"
if [ ${PAUSE_MODE} = 1 ]; then
pause
fi
# The Counter is set to 86400 because it represents seconds in Unix Time and 86400 seconds are 1 day
Counter=86400
# I'm going to convert $lastrevdate to Unix Time so I can add days to it
lastrevdateUE=$(date2stamp $lastrevdate)
# Adding one day to $getdateUE and converting it to YYYY-MM-DD date format to be assigned to $getdate
getdateUE=$(echo $lastrevdateUE+$Counter | bc)
getdate=$(stamp2date $getdateUE)
today=$(date -d "+2 day" +"%F")
# Right below is the original code to assign $getdate and add x number of days, that didn't work for me. The $Counter used to be 1
# getdate=$(date --date="$lastrevdate" -d "+"$Counter" day" +"%F")
rm $SOURCES_DIR/sql/updates/*.sql
while [ "$today" != "$getdate" ]
do
lastrevyear=$(echo $getdate | cut -c1-4)
lastrevmonth=$(echo $getdate | cut -c6-7)
lastrevday=$(echo $getdate | cut -c9-10)
since=$lastrevyear"_"$lastrevmonth"_"$lastrevday
cat $SOURCES_DIR/sql/updates/world/$since*.sql >> world_updates.sql
cat $SOURCES_DIR/sql/updates/auth_char/$since"_characters"*.sql >> character_updates.sql
cat $SOURCES_DIR/sql/updates/auth_char/$since"_auth"*.sql >> auth_updates.sql
let Counter=$Counter+86400
# I'm adding 86400 seconds again (1 day) to $getdateUE (Unix Time) and then converting to YYYY-MM-DD
getdateUE=$(echo $lastrevdateUE+$Counter | bc)
getdate=$(stamp2date $getdateUE)
# Right below is the original code to update $getdate and add one day, that didn't work for me. The $Counter used to be incremented by 1
# getdate=$(date --date="$lastrevdate" -d "+"$Counter" day" +"%F")
done
rm -R $INSTALL_DIR/sql
mkdir $INSTALL_DIR/sql
mv *.sql $INSTALL_DIR/sql
EDIT: I have made another change in CMAKE section. I added the parameter -march=native
Just check your gcc version before using it…
-march=native
GCC 4.2 introduces a new -march option, -march=native, which automatically detects the features your CPU supports and sets the options appropriately. If you have an Intel or AMD CPU and are using >=sys-devel/gcc-4.2.3, using -march=native is recommended. Do not use -march=native if you use distcc on nodes with different architectures as this may produce unusable code.
export CXXFLAGS="-march=native -O3"
export CFLAGS="-march=native -O3"
Let’s suppose I install TC today (2011-09-02) and update using the above script on 2011-09-10. The script will add up all the updates from 2011-09-03 onwards to 2011-09-10, which seems OK. [SIZE=18px]BUT[/SIZE], if SQL updates come out today (dated 2011-09-02) AT A LATER TIME than my installation, the script will miss those updates, because it will start from 2011-09-03 /emoticons/default_sad.png
That’s why I’ve changed the variable Counter to zero, so that the script will start picking updates with the same date as the installation. The worst thing that can happen is to import one day’s updates, twice which is far much better than to miss out on updates. Importing one day’s updates twice, with no other updates done in-between, should be no problem.
Counter=0
I keep improving the code (and replying to this thread) because I really like Athena’s update script /emoticons/default_wub.png
EDIT: I have made another change in CMAKE section. I added the parameter -march=native
Just check your gcc version before using it…
[/SPOILER]
export CXXFLAGS="-march=native -O3"
export CFLAGS="-march=native -O3"
Using your modifications over the original posters on this thread and got a really nice working script.
Tanks for great job
I have made some more corrections if you’re interested
I’m attaching the whole script (indentation does not work if I copy/paste in CODE tags).
nice… 1st post updated. /emoticons/default_wink.png
The updater do not work for me. It prints the following output:
+------------------------------------------------------------------------------+
| Step 6 of 5 Completed. |
| TrinityCore build completed. |
| Check for any errors. |
| |
| You will find a revision.log file with the latest |
| and actual revision and is dates, if you need |
| to revert any changes. |
| |
./doMake: line 523: [: =: unary operator expected
+------------------------------------------------------------------------------+
./doMake: line 530: [: =: unary operator expected
./doMake: line 537: [: =: unary operator expected
— Canned message start —
You smell that? It was this thread rotting.
You just played:
http://img227.imageshack.us/img227/8899/threadnecromancerji6.jpg
— Canned message end —