Last change
on this file since 13823 was 10690, checked in by rick, 13 years ago |
Fix issues of not checking duplicates IPs.
While here, add feature that commits which mention no-genesis-check force-fully
overrides the config validators errors.
Related-To: beheer#211
|
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Id
|
File size:
1.2 KB
|
Line | |
---|
1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # Check for valid genesis syntax
|
---|
4 | #
|
---|
5 | # Rick van der Zwet <rick@wirelessleiden.nl>
|
---|
6 | #
|
---|
7 | REPOS="$1"
|
---|
8 | TXN="$2"
|
---|
9 |
|
---|
10 | TMPDIR=`mktemp -d -t $(basename $0 .sh)`
|
---|
11 |
|
---|
12 | # External definition used for debugging
|
---|
13 | SVNLOOK="${SVNLOOK:-/usr/local/bin/svnlook --transaction $TXN}"
|
---|
14 | GENESISDIR='node-config/genesis'
|
---|
15 |
|
---|
16 | # Check whether we need to check something first
|
---|
17 | $SVNLOOK changed -t $TXN $REPOS | grep -q $GENESISDIR
|
---|
18 | if [ $? -eq 1 ]; then
|
---|
19 | exit 0
|
---|
20 | fi
|
---|
21 |
|
---|
22 | # Allow us to commit stuff even if the validator fails
|
---|
23 | $SVNLOOK log -t $TXN $REPOS | grep -q 'no-genesis-check' && exit 0
|
---|
24 |
|
---|
25 | # Clean up on exit
|
---|
26 | trap "rm -R $TMPDIR" 0 1 2 3 15
|
---|
27 |
|
---|
28 | echo "Checking genesis config, please hold your horses..." 1>&2
|
---|
29 | for ENTRY in `$SVNLOOK tree --full-paths $REPOS $GENESISDIR`; do
|
---|
30 | echo $ENTRY | grep -q 'retired' && continue
|
---|
31 |
|
---|
32 | echo $ENTRY | grep -q '/$'
|
---|
33 | if [ $? -eq 0 ]; then
|
---|
34 | mkdir -p $TMPDIR/$ENTRY
|
---|
35 | else
|
---|
36 | $SVNLOOK cat $REPOS $ENTRY > $TMPDIR/$ENTRY
|
---|
37 | fi
|
---|
38 | done
|
---|
39 |
|
---|
40 | # Do actual checking
|
---|
41 | echo $TMPDIR/$GENESISDIR/tools/before-commit.sh 1>&2
|
---|
42 | sh $TMPDIR/$GENESISDIR/tools/before-commit.sh 2>> $TMPDIR/log.txt 1>>$TMPDIR/log.txt
|
---|
43 | RETVAL=$?
|
---|
44 |
|
---|
45 | sed "s+$TMPDIR/node-config/genesis/nodes/++g" $TMPDIR/log.txt 1>&2
|
---|
46 |
|
---|
47 | exit $RETVAL
|
---|
Note:
See
TracBrowser
for help on using the repository browser.