-
Notifications
You must be signed in to change notification settings - Fork 23
/
watch_build.sh
executable file
·65 lines (54 loc) · 1.95 KB
/
watch_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
#!/bin/bash
# Copyright (c) 2017 MAZA Network Developers, Robert Nelson (guruvan)
. /host_vagrantdir/USER_CONFIG.env
test -f /home/vagrant/gitian-builder/.build_list || { echo "Build not started, try again later" ; exit 2; }
builds=$(wc -l /home/vagrant/gitian-builder/.build_list|awk '{print $1}')
while [ "$builds" -ge 1 ]; do
line=$(head -n 1 /home/vagrant/gitian-builder/.build_list)
printf "\nCurrent build: %s\n\n" "$line"
printf "Number of Builds to run: %s\n\n" "$builds"
printf "\nWaiting for %s build to begin install to LXC vm\n\n" "$line"
x=0
while [ $x -eq 0 ] ; do
#echo "waiting for install.log"
if [ -f /home/vagrant/gitian-builder/var/install.log ] ;then
tail -f /home/vagrant/gitian-builder/var/install.log & IL_PID=$!
echo "Build Install has started"
x=1
else
echo "Install process is not started yet"
test -f /home/vagrant/gitian-builder/.build_list || { echo "Build Ended" ; exit 1; }
sleep 5
fi
done
x=0
while [ $x -eq 0 ] ; do
echo "Waiting for build to to start"
if [ -f /home/vagrant/gitian-builder/var/build.log ] ;then
kill "${IL_PID}" > /dev/null 2>&1
tail -f /home/vagrant/gitian-builder/var/build.log & BL_PID=$!
echo "tail"
x=1
sleep 5
else
test -f /home/vagrant/gitian-builder/.build_list || { echo "Build Ended" ; exit 1; }
echo "still waiting for build.log"
sleep 5
fi
done
while true; do
NEW=$(md5sum /home/vagrant/gitian-builder/var/build.log)
if [ "$NEW" = "$LAST" ]; then
kill "${BL_PID}" > /dev/null 2>&1
printf "\nBuild Log for %s Complete\n\n" "$line"
break
fi
LAST="$NEW"
sleep 90
done
test -f /home/vagrant/gitian-builder/.build_list || { echo "Build Ended" ; exit 1; }
#sed -i '1d' /home/vagrant/gitian-builder/.build_list
builds=$(wc -l /home/vagrant/gitian-builder/.build_list|awk '{print $1}')
done
rm /home/vagrant/gitian-builder/.build_list
printf "\nBuild List Complete - your build should be done.\n\n"