1820 |
mateusz.vi |
1 |
#!/bin/bash
|
636 |
mateusz.vi |
2 |
#
|
|
|
3 |
# this script looks for the presence of /tmp/svardos_repo_changed.flag file
|
|
|
4 |
# and rebuilds the packages index if it exists (then deletes the flag).
|
|
|
5 |
#
|
|
|
6 |
# it is supposed to be called periodically from within a cron job.
|
|
|
7 |
#
|
|
|
8 |
# the /tmp/svardos_repo_changed.flag file is expected to be created by an
|
|
|
9 |
# svn post-commit hook whenever something in the svn repo changes.
|
1820 |
mateusz.vi |
10 |
#
|
|
|
11 |
# bash is required because I use the internal bash "read" command.
|
636 |
mateusz.vi |
12 |
|
850 |
mateusz.vi |
13 |
REPOFLAGFILE="/tmp/svardos_repo_changed.flag"
|
|
|
14 |
REBUILDFLAGFILE="/tmp/svardos_rebuild_please.flag"
|
636 |
mateusz.vi |
15 |
SVNREPODIR="/srv/svardos"
|
|
|
16 |
|
850 |
mateusz.vi |
17 |
# exit if repo did not change
|
|
|
18 |
if [ ! -f "$REPOFLAGFILE" ] ; then
|
636 |
mateusz.vi |
19 |
exit 0
|
|
|
20 |
fi
|
|
|
21 |
|
850 |
mateusz.vi |
22 |
# delete the flag files as soon as possible to limit the time of possible
|
|
|
23 |
# collisions
|
|
|
24 |
rm "$REPOFLAGFILE"
|
636 |
mateusz.vi |
25 |
|
850 |
mateusz.vi |
26 |
NEEDTOREBUILD=0
|
|
|
27 |
if [ -f "$REBUILDFLAGFILE" ] ; then
|
|
|
28 |
rm "$REBUILDFLAGFILE"
|
|
|
29 |
NEEDTOREBUILD=1
|
|
|
30 |
fi
|
|
|
31 |
|
|
|
32 |
|
|
|
33 |
# refresh the local copy of the repo and rebuild packages index
|
636 |
mateusz.vi |
34 |
svn up "$SVNREPODIR"
|
1698 |
mateusz.vi |
35 |
rm -rf "$SVNREPODIR/packages/latest"
|
732 |
mateusz.vi |
36 |
php "$SVNREPODIR/buildidx/buildidx.php" "$SVNREPODIR/packages/" > "$SVNREPODIR/packages/_buildidx.log"
|
636 |
mateusz.vi |
37 |
|
1820 |
mateusz.vi |
38 |
|
|
|
39 |
###############################################################################
|
|
|
40 |
# #
|
|
|
41 |
# build the ISO that contains all latest packages from the repo #
|
|
|
42 |
# (and make it bootable using latest STABLE boot floppy) #
|
|
|
43 |
# #
|
|
|
44 |
###############################################################################
|
|
|
45 |
|
|
|
46 |
read -r STABLE < "$SVNREPODIR/website/default_build.txt"
|
|
|
47 |
unzip -o "$SVNREPODIR/website/download/$STABLE/svardos-$STABLE-floppy-2.88M.zip" disk1.img -d /tmp/
|
|
|
48 |
mv /tmp/disk1.img "$SVNREPODIR/packages/latest/boot.img"
|
|
|
49 |
mkisofs -input-charset cp437 -b boot.img -hide boot.img -hide boot.catalog -iso-level 1 -f -V SVARDOS_REPO -o "$SVNREPODIR/website/repo/sv-repo.tmp" "$SVNREPODIR"/packages/latest/*
|
|
|
50 |
rm -f "$SVNREPODIR/packages/latest/boot.img"
|
1699 |
mateusz.vi |
51 |
mv "$SVNREPODIR/website/repo/sv-repo.tmp" "$SVNREPODIR/website/repo/sv-repo.iso"
|
|
|
52 |
md5sum "$SVNREPODIR/website/repo/sv-repo.iso" > "$SVNREPODIR/website/repo/sv-repo.iso.md5"
|
854 |
mateusz.vi |
53 |
|
1699 |
mateusz.vi |
54 |
|
850 |
mateusz.vi |
55 |
# do I need to rebuild the install images as well?
|
|
|
56 |
if [ "$NEEDTOREBUILD" -ne 0 ] ; then
|
854 |
mateusz.vi |
57 |
CURDATE=`date +%Y%m%d`
|
|
|
58 |
DESTDIR="website/download/$CURDATE"
|
850 |
mateusz.vi |
59 |
cd "$SVNREPODIR"
|
854 |
mateusz.vi |
60 |
rm -rf "$DESTDIR"
|
|
|
61 |
mkdir "$DESTDIR"
|
|
|
62 |
./build.sh "$DESTDIR" "$CURDATE" > "$DESTDIR/build.log" 2>&1
|
850 |
mateusz.vi |
63 |
fi
|
|
|
64 |
|
636 |
mateusz.vi |
65 |
exit 0
|