-
Notifications
You must be signed in to change notification settings - Fork 2
/
start-build.sh
executable file
·93 lines (68 loc) · 1.84 KB
/
start-build.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
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
######################################################################################
## Check for modification an start new build process if necessary
## based on files with git hashes (generated by pull-repos.sh).
######################################################################################
date
cd ..
if [ ! -d "site" ]; then
echo "This script must be called from within the site directory"
exit 1
fi
cd site
PATH_GLUON=/home/freifunk/gluon
PATH_FFWP=/home/freifunk/.ffwp
PATH_LOG=$PATH_FFWP/fw/log
FILE_SITE=$PATH_FFWP/fw/site.sha
FILE_GLUON=$PATH_FFWP/fw/gluon.sha
FILE_SITE_OLD=$PATH_FFWP/fw/site.old.sha
FILE_GLUON_OLD=$PATH_FFWP/fw/gluon.old.sha
FILE_LOG=$PATH_LOG/nightly_build.log
if [ ! -f "$FILE_SITE_OLD" ]; then
echo "1" > $FILE_SITE_OLD
fi
if [ ! -f "$FILE_GLUON_OLD" ]; then
echo "1" > $FILE_GLUON_OLD
fi
if [ ! -f "$FILE_SITE" ]; then
echo "0" > $FILE_SITE
fi
if [ ! -f "$FILE_GLUON" ]; then
echo "0" > $FILE_GLUON
fi
echo "Repositories aktualisieren..."
./pull-repos.sh
date
SITE_HASH=`cat $FILE_SITE`
SITE_HASH_OLD=`cat $FILE_SITE_OLD`
GLUON_HASH=`cat $FILE_GLUON`
GLUON_HASH_OLD=`cat $FILE_GLUON_OLD`
NEED_BUILD=0
echo "Site $SITE_HASH_OLD -> $SITE_HASH"
echo "Gluon $GLUON_HASH_OLD -> $GLUON_HASH"
#echo "NeedBuild: $NEED_BUILD"
if [ "$SITE_HASH" = "$SITE_HASH_OLD" ];then
NEED_BUILD=0
else
NEED_BUILD=1
fi
#echo $NEED_BUILD
if [ "$GLUON_HASH" = "$GLUON_HASH_OLD" ];then
NEED_BUILD=$(($NEED_BUILD + 0))
else
NEED_BUILD=$(($NEED_BUILD + 1))
fi
echo "NeedBuild: $NEED_BUILD"
if [ $NEED_BUILD -gt 0 ];then
echo "Build notwendig, starte Build-Prozess..."
./make-release.sh
if [ $? -eq 0 ];then
echo $GLUON_HASH > $FILE_GLUON_OLD
echo $SITE_HASH > $FILE_SITE_OLD
cp $FILE_LOG $PATH_GLUON/output/images/.build_overview.txt
fi
else
echo "Kein Build notwendig. ENDE."
fi
date
exit 0