root/swish_website/build.sh

Revision 1998, 1.7 kB (checked in by karpet, 5 months ago)

just use -q op

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1 #!/bin/bash
2
3 # Rebuild the site, and if any files are written reindex
4 # This is expected to be run as a cron job
5 #
6 #  build.sh $ROOT [-a]
7 #  Optionally set SWISH_SITE=http://whatever to change the location of
8 # the site indexed (useful for local debugging)
9
10
11 if test ! -n "$1"; then
12     echo "Must specify path to the root of the site (e.g. $HOME)"
13     exit 1
14 fi
15
16 # Directory where everything happens
17 ROOT="$1"
18 shift;
19
20
21 SVN="$ROOT/swish_website"
22 SWISH_SITE=${SWISH_SITE:=http://swish-e.org}
23 SPIDER_QUIET=${SPIDER_QUIET:=1}
24
25 export SPIDER_QUIET SWISH_SITE
26
27
28 # Where to store output from svn
29 TMP=/tmp/swish_website.$$.tmp
30
31
32 # First try and do a svn update
33
34 cd $SVN
35
36 if ! svn update &>$TMP; then
37     echo "svn update failed"
38     echo
39     cat $TMP; rm $TMP
40     exit
41 fi
42
43 if ! svn stat -q &>$TMP; then
44     echo "svn stat failed"
45     echo
46     cat $TMP; rm $TMP
47     exit
48 fi
49
50 # Look out for any local problems
51 #    A  Added
52 #    D  Deleted
53 #    U  Updated
54 #    C  Conflict
55 #    G  Merged
56
57 # Check for conflicts -- which should not happen
58 # unless messing with the source locally
59
60 if egrep '^C ' $TMP >/dev/null; then
61     echo "Some files need attention"
62     echo
63     cat $TMP
64     rm  $TMP
65     exit
66 fi
67
68
69
70
71 # Now build the website, if any -a passed or if "Updated to revision" is returned.
72 # Or perhaps could just check for (A|C|D|U|G)
73
74 if [ -n "$(echo $@ | grep -- '-a')"  ] || egrep '^[ADUCGM] ' $TMP >/dev/null; then
75     echo "updating site.  Changes:"
76     cat $TMP
77
78     if $SVN/bin/build --root $ROOT $@; then
79         echo "rebuilding site index"
80
81         swish-e \
82             -c $SVN/etc/swish.config \
83             -S prog \
84             -f $ROOT/indexes/index.swish-e \
85             -v 0 || echo "Had problem runnning swish"
86
87     else
88         echo "Problem building site"
89
90     fi
91
92 fi
93
94
95 rm $TMP
Note: See TracBrowser for help on using the browser.