forked from istlab/web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
executable file
·65 lines (53 loc) · 1.43 KB
/
update.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
#!/bin/sh
#
# Executed periodically by istlab:iweb to update the web page
#
export PATH=/usr/local/bin:$PATH
cd web
# Fetch updates and see if something was fetched
git fetch 2>fetch.out || exit 1
if ! [ -s fetch.out ]
then
exit 0
fi
# Show us what has changed
cat fetch.out
if egrep '[0-9a-f]{7}\.\.[0-9a-f]{7}' fetch.out >/dev/null
then
git log `awk '/->/ {print $1}' fetch.out`
fi
# There is work to integrate; rebuild
git merge origin
# Check for errors
AE=$(git log -n 1 --format=%ae)
AN=$(git log -n 1 --format=%ae)
rm -rf ../sandbox
mkdir ../sandbox
cp -r * ../sandbox
cd ../sandbox
if ! make >make.out 2>&1 ; then
(
cat <<EOF
From: ISTLab web continuous integration <[email protected]>
Subject: Failed ISTLab web page change
To: "$AN" <$AE>
Cc: Diomidis Spinellis <[email protected]>
Reply-To: Diomidis Spinellis <[email protected]>
Dear $AN,
Sadly, a change you appear to have made to the ISTLab web site has
broken its build. This is not a big problem; your changes will not be
integrated until the build succeeds. The log of the build process appears
below. Typically errors occur due to invalid XML or BibTeX files. Please
correct the error and push again.
EOF
cat make.out
) |
/usr/sbin/sendmail [email protected] $AE
rm -rf ../sandbox
exit 1
fi
cd ../web
rm -rf ../sandbox
make clean html report brochure && \
rm -rf /home/dds/web/istlab/content/* && \
tar -C public_html -cf - . | tar -mU -C /home/dds/web/istlab/content -xf -