Subversion Repositories SvarDOS

Rev

Rev 854 | Rev 1699 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
636 mateusz.vi 1
#!/bin/sh
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.
10
 
11
 
850 mateusz.vi 12
REPOFLAGFILE="/tmp/svardos_repo_changed.flag"
13
REBUILDFLAGFILE="/tmp/svardos_rebuild_please.flag"
636 mateusz.vi 14
SVNREPODIR="/srv/svardos"
15
 
850 mateusz.vi 16
# exit if repo did not change
17
if [ ! -f "$REPOFLAGFILE" ] ; then
636 mateusz.vi 18
  exit 0
19
fi
20
 
850 mateusz.vi 21
# delete the flag files as soon as possible to limit the time of possible
22
# collisions
23
rm "$REPOFLAGFILE"
636 mateusz.vi 24
 
850 mateusz.vi 25
NEEDTOREBUILD=0
26
if [ -f "$REBUILDFLAGFILE" ] ; then
27
  rm "$REBUILDFLAGFILE"
28
  NEEDTOREBUILD=1
29
fi
30
 
31
 
32
# refresh the local copy of the repo and rebuild packages index
636 mateusz.vi 33
svn up "$SVNREPODIR"
1698 mateusz.vi 34
rm -rf "$SVNREPODIR/packages/latest"
732 mateusz.vi 35
php "$SVNREPODIR/buildidx/buildidx.php" "$SVNREPODIR/packages/" > "$SVNREPODIR/packages/_buildidx.log"
636 mateusz.vi 36
 
854 mateusz.vi 37
 
850 mateusz.vi 38
# do I need to rebuild the install images as well?
39
if [ "$NEEDTOREBUILD" -ne 0 ] ; then
854 mateusz.vi 40
  CURDATE=`date +%Y%m%d`
41
  DESTDIR="website/download/$CURDATE"
850 mateusz.vi 42
  cd "$SVNREPODIR"
854 mateusz.vi 43
  rm -rf "$DESTDIR"
44
  mkdir "$DESTDIR"
45
  ./build.sh "$DESTDIR" "$CURDATE" > "$DESTDIR/build.log" 2>&1
850 mateusz.vi 46
fi
47
 
636 mateusz.vi 48
exit 0