Ok thx to MadCamel and Jaxad0127.
I have tried those commands and they seem to work.
Here is a script which restarts the whole server, and updates all of the repos and the files.
Please have a look and comment on that.
This script assumes this structure on the folder it is run on:
Code: Select all
ls -l
7546 2010-12-31 01:51 adler32 - the hash calculator checkout out and compiled from mana repo
4096 2010-12-31 01:56 eathena - The server sources
4096 2010-12-29 21:44 eathena-data - the server content
66 2010-12-31 02:02 resources2.txt - the file which contains all the zip files and its hashes
1055 2010-12-31 02:07 restart.sh - This script is shown below
4096 2010-12-31 01:54 tmwdata - clients data
134733 2010-12-31 01:52 update-ba63d39..e86f9e1.zip - lots of those here, the updated zip files
Code: Select all
#!/bin/bash
killall login-server
killall char-server
killall map-server
# get new server binaries
cd eathena
git pull
make
cd ..
# copy the binaries to the eathena-data
cp ./eathena/login-server ./eathena-data
cp ./eathena/char-server ./eathena-data
cp ./eathena/map-server ./eathena-data
# get new content
cd eathena-data
git pull
cd conf
cat magic.conf.template | ./spells-build > magic.conf
cd ..
./login-server &
./char-server &
./map-server &
cd ..
# calculate the update for clients tmwdata
cd tmwdata
#caclulate the commits which got added
previous=`git log --pretty=oneline -n 1 | awk '{print $1}'`
git pull
head=`git log --pretty=oneline -n 1 | awk '{print $1}'`
# get the short form of the commit hashes
u1=`echo ${previous} | cut -c 1-7`
u2=`echo ${head} | cut -c 1-7`
# get the filelist and zip those files
git log --name-status ${previous}..${head} | awk '/^(A|M)\t/ {print $2}' | sort | uniq | xargs zip -9 -r ../update-${u1}..${u2}.zip
cd ..
# append the zip file to resources2.txt
./adler32 update-${u1}..${u2}.zip >>resources2.txt