Last change
on this file since 13191 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
|
Rev | Line | |
---|
[7300] | 1 | #!/bin/sh
|
---|
| 2 | #
|
---|
| 3 | # Check for valid genesis syntax
|
---|
[10690] | 4 | #
|
---|
| 5 | # Rick van der Zwet <rick@wirelessleiden.nl>
|
---|
| 6 | #
|
---|
[7300] | 7 | REPOS="$1"
|
---|
| 8 | TXN="$2"
|
---|
| 9 |
|
---|
| 10 | TMPDIR=`mktemp -d -t $(basename $0 .sh)`
|
---|
[10091] | 11 |
|
---|
[7300] | 12 | # External definition used for debugging
|
---|
| 13 | SVNLOOK="${SVNLOOK:-/usr/local/bin/svnlook --transaction $TXN}"
|
---|
[10091] | 14 | GENESISDIR='node-config/genesis'
|
---|
[7300] | 15 |
|
---|
| 16 | # Check whether we need to check something first
|
---|
[10690] | 17 | $SVNLOOK changed -t $TXN $REPOS | grep -q $GENESISDIR
|
---|
[7300] | 18 | if [ $? -eq 1 ]; then
|
---|
| 19 | exit 0
|
---|
| 20 | fi
|
---|
| 21 |
|
---|
[10690] | 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 |
|
---|
[7300] | 28 | echo "Checking genesis config, please hold your horses..." 1>&2
|
---|
| 29 | for ENTRY in `$SVNLOOK tree --full-paths $REPOS $GENESISDIR`; do
|
---|
[10091] | 30 | echo $ENTRY | grep -q 'retired' && continue
|
---|
| 31 |
|
---|
[7300] | 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
|
---|
[10091] | 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
|
---|
[7300] | 43 | RETVAL=$?
|
---|
| 44 |
|
---|
[7306] | 45 | sed "s+$TMPDIR/node-config/genesis/nodes/++g" $TMPDIR/log.txt 1>&2
|
---|
[7300] | 46 |
|
---|
| 47 | exit $RETVAL
|
---|
Note:
See
TracBrowser
for help on using the repository browser.