-
Notifications
You must be signed in to change notification settings - Fork 348
/
init.sh
executable file
·59 lines (54 loc) · 1.23 KB
/
init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
set -u
set -e
function usage() {
echo ""
echo "Usage:"
echo " $0 [raft | istanbul | clique] [--numNodes numberOfNodes]"
echo ""
echo "Where:"
echo " raft | istanbul | clique (default = raft): specifies which consensus algorithm to use"
echo " numberOfNodes is the number of nodes to initialise (default = $numNodes)"
echo ""
exit -1
}
consensus=raft
numNodes=7
while (( "$#" )); do
case "$1" in
raft)
consensus=raft
shift
;;
istanbul)
consensus=istanbul
shift
;;
clique)
consensus=clique
shift
;;
--numNodes)
re='^[0-9]+$'
if ! [[ $2 =~ $re ]] ; then
echo "ERROR: numberOfNodes value must be a number"
usage
fi
numNodes=$2
shift 2
;;
--help)
shift
usage
;;
*)
echo "Error: Unsupported command line parameter $1"
usage
;;
esac
done
if [[ "$numNodes" -gt 7 ]] ; then
echo "number of node greater than 7 not supported"
exit -1
fi
./$consensus-init.sh --numNodes $numNodes