-
Notifications
You must be signed in to change notification settings - Fork 2
/
pull-repos.sh
executable file
·82 lines (68 loc) · 2.43 KB
/
pull-repos.sh
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
######################################################################################
## This script refreshs our working copies of following github repositories:
## - gluon (release, has to be changed manually in here, if there is a new releas )
## - ffwp-site (current master)
##
## The old and new git hashs are stored in files.
## These files are checked by start-build.sh for deciding if a new build process
## has to be started.
######################################################################################
cd ..
if [ ! -d "site" ]; then
echo "This script must be called from within the site directory"
exit 1
fi
PATH_FFWP=/home/freifunk/.ffwp
PATH_LOG=$PATH_FFWP/fw/log
LOGFILE=$PATH_LOG/pull.log
FILE_SITE=$PATH_FFWP/fw/site.sha
FILE_SITE_OLD=$PATH_FFWP/fw/site.old.sha
FILE_GLUON=$PATH_FFWP/fw/gluon.sha
FILE_GLUON_OLD=$PATH_FFWP/fw/gluon.old.sha
rm $LOGFILE
date > $LOGFILE
#-------------------------------------------------------------------------------------
# refresh site directory
cd site
echo -e "--- site directory ---" >> $LOGFILE
git remote -v >> $LOGFILE 2>&1
echo branch >> $LOGFILE
git branch|grep \* >> $LOGFILE 2>&1
SITE_HASH=(`git log --pretty=format:'%H' -n 1`)
echo $SITE_HASH >> $LOGFILE 2>&1
#echo $SITE_HASH > $FILE_SITE_OLD
touch $FILE_SITE_OLD
git checkout master > $LOGFILE 2>&1
git pull > $LOGFILE 2>&1
SITE_HASH=(`git log --pretty=format:'%H' -n 1`)
echo $SITE_HASH >> $LOGFILE 2>&1
echo $SITE_HASH > $FILE_SITE
#-------------------------------------------------------------------------------------
# refresh gluon directory
cd ..
echo -e "" >> $LOGFILE
echo -e "" >> $LOGFILE
echo -e "--- gluon directory ---" >> $LOGFILE
git remote -v >> $LOGFILE 2>&1
echo branch >> $LOGFILE
git branch|grep \* >> $LOGFILE 2>&1
GLUON_HASH=(`git log --pretty=format:'%H' -n 1`)
echo $GLUON_HASH >> $LOGFILE 2>&1
#echo $GLUON_HASH > $FILE_GLUON_OLD
touch $FILE_GLUON_OLD
#git checkout master >> $LOGFILE 2>&1
#git pull >> $LOGFILE 2>&1
#get latest tags
git fetch origin 'refs/tags/*:refs/tags/*' >> $LOGFILE 2>&1
#git tag -l >> $LOGFILE 2>&1
LATEST_TAG=(`git tag -l |tail -1`)
echo -e "pulled latest tag: $LATEST_TAG" >> $LOGFILE 2>&1
LATEST_TAG=v2017.1.8
echo -e "used tag: $LATEST_TAG" >> $LOGFILE 2>&1
git checkout tags/$LATEST_TAG >> $LOGFILE 2>&1
git pull >> $LOGFILE 2>&1
GLUON_HASH=(`git log --pretty=format:'%H' -n 1`)
echo $GLUON_HASH >> $LOGFILE 2>&1
echo $GLUON_HASH > $FILE_GLUON
exit 0