Subversion Repositories SvarDOS

Rev

Rev 1698 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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