aboutsummaryrefslogtreecommitdiffstats
path: root/checkupdate.sh
blob: 8c3632327fc91aede2f39b155a9a34514ca4b61e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash


#git checkout MaYor-dev
git checkout master

if [ $? == 0 ]; then
	orev=$(cat rev.txt)
	nrev=$(wget http://www.mayor.hu/download/current/md5sum -O - | grep 'Revision' | cut -d ' ' -f 2)

	pd=$(pwd)


	if [ "$nrev" -gt "$orev" ]; then 

		wget http://www.mayor.hu/download/current/rev.txt -O rev.txt
		wget http://www.mayor.hu/download/current/md5sum  -O mayor-orig/md5sum

		cd /tmp

		for i in $(cat "$pd"/mayor-orig/md5sum | tail -n+2 | cut -d ' ' -f 3); do
		
			j=$(echo $i | sed -e 's/-rev.*//g')
			wget http://www.mayor.hu/download/current/"$i"
			if [ ! -d "$pd/mayor-orig/$i" ]; then
				mkdir "$pd"/mayor-orig/"$j"
			fi
			tar -xzvf /tmp/"$i" -C "$pd"/mayor-orig/"$j"
	
		done

	
		cd $pd
		cp -f 'rev.txt' 'mayor-orig/rev.txt'
		cp -rf 'mayor-installer/mayor-installer-orig/log/' 'mayor-installer/mayor-installer-jav/'
		cp -rf 'mayor-installer/mayor-installer-orig/log/' 'mayor-installer/mayor-installer-for-fcgi/'

		git add --all
		git commit -a -m "Rev: $nrev"
		git tag -a "rev$nrev" -m "Rev: $nrev"

	fi

#	git checkout @{-1}
fi