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

Last change on this file since 10032 was 7306, checked in by rick, 15 years ago

Provide a neat error messages

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