source: genesis/tools/svn-hook/genesis-check.sh@ 10309

Last change on this file since 10309 was 10091, checked in by rick, 13 years ago

Working copies at server, now with new python stuff.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 1.0 KB
Line 
1#!/bin/sh
2#
3# Check for valid genesis syntax
4# Rick van der Zwet, 2009
5REPOS="$1"
6TXN="$2"
7
8TMPDIR=`mktemp -d -t $(basename $0 .sh)`
9
10# Clean up
11trap "rm -R $TMPDIR; exit 0" 0
12trap "rm -R $TMPDIR; exit 1" 1 2 15
13
14# External definition used for debugging
15SVNLOOK="${SVNLOOK:-/usr/local/bin/svnlook --transaction $TXN}"
16GENESISDIR='node-config/genesis'
17
18# Check whether we need to check something first
19$SVNLOOK changed $REPOS | grep -q $GENESISDIR
20if [ $? -eq 1 ]; then
21 exit 0
22fi
23
24echo "Checking genesis config, please hold your horses..." 1>&2
25for ENTRY in `$SVNLOOK tree --full-paths $REPOS $GENESISDIR`; do
26 echo $ENTRY | grep -q 'retired' && continue
27
28 echo $ENTRY | grep -q '/$'
29 if [ $? -eq 0 ]; then
30 mkdir -p $TMPDIR/$ENTRY
31 else
32 $SVNLOOK cat $REPOS $ENTRY > $TMPDIR/$ENTRY
33 fi
34done
35
36# Do actual checking
37echo $TMPDIR/$GENESISDIR/tools/before-commit.sh 1>&2
38sh $TMPDIR/$GENESISDIR/tools/before-commit.sh 2>> $TMPDIR/log.txt 1>>$TMPDIR/log.txt
39RETVAL=$?
40
41sed "s+$TMPDIR/node-config/genesis/nodes/++g" $TMPDIR/log.txt 1>&2
42
43exit $RETVAL
Note: See TracBrowser for help on using the repository browser.