-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebc-build.sh
executable file
·71 lines (50 loc) · 1.52 KB
/
webc-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
#!/bin/bash -e
branch=${1:-master}
OUTPUT="/srv/www/build.webconverger.org"
sha=$(git ls-remote git://github.com/Webconverger/webc.git refs/heads/$branch)
shortsha=${sha:0:7}
if ls $OUTPUT/webc-$shortsha.*
then
echo Already built!
exit
fi
BUILDID=webconverger.$branch.$(date --rfc-3339=date)
LOG=$OUTPUT/$BUILDID.txt
echo Building $BUILDID ... logging to $OUTPUT/$BUILDID.txt
exec >$LOG 2>&1
figlet $branch $shortsha
test "$DEBUG" && echo $PATH
if test "$(id -u)" -ne "0"
then
echo "Super user required" >&2
exit 1
fi
TEMPDIR="$(mktemp -d -t $BUILDID.XXXXXXXX)" || exit 1
test "$DEBUG" || trap "rm -rf $TEMPDIR" EXIT
test "$DEBUG" && echo TEMPDIR $TEMPDIR
mailerror () {
echo BUILD FAILED at $BUILDID
echo "$LOG" |
mail -a 'From: [email protected]' -s "$BUILDID failed" [email protected]
exit 1
}
chmod a+rx $TEMPDIR && cd $TEMPDIR
test "$DEBUG" && mount
if test "$(/sbin/losetup -a | wc -l)" -gt 0
then
echo Unclean mounts!
losetup -a
exit
fi
echo "Debian Live, live-build version: "
dpkg --status live-build | egrep "^Version" | awk '{print $2}'
git clone --depth 1 git://github.com/Webconverger/Debian-Live-config.git
cd Debian-Live-config/webconverger
# info about build config we have
git describe --always
# http://webconverger.org/upgrade/
make BRANCH=$branch
chown -R www-data:www-data $OUTPUT
mv live-image-i386.hybrid.iso $OUTPUT/webc-$shortsha.iso
echo -e "Options All\nOptions Indexes FollowSymLinks" > $OUTPUT/.htaccess
echo "Redirect /latest.iso /webc-$shortsha.iso" >> $OUTPUT/.htaccess