forked from informalsystems/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev-env
executable file
·57 lines (44 loc) · 1.07 KB
/
dev-env
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
#!/bin/bash -e
usage() {
echo "Usage: $0 CONFIG_FILE CHAIN_0_ID CHAIN_1_ID [CHAIN_2_ID] [--non-interactive]"
echo "Example: $0 ./config.toml ibc-0 ibc-1 ibc-2"
exit 1
}
missing() {
echo "Missing $1 parameter. Please check if all parameters were specified."
usage
}
if [ ! -r "$1" ]; then
missing "CONFIG_FILE ($1)"
fi
if [ -z "$2" ]; then
missing "CHAIN_0_ID"
fi
if [ -z "$3" ]; then
missing "CHAIN_1_ID"
fi
if [ "$#" -gt 5 ]; then
echo "Incorrect number of parameters."
usage
fi
NON_INTERACTIVE=""
if [ "$#" -eq 4 ]; then
if [ "$4" == "--non-interactive" ]; then
NON_INTERACTIVE="--non-interactive"
else
CHAIN_2_ID="$4"
fi
fi
if [ "$#" -eq 5 ]; then
CHAIN_2_ID="$4"
if [ "$5" == "--non-interactive" ]; then
NON_INTERACTIVE="--non-interactive"
fi
fi
CONFIG_FILE="$1"
CHAIN_0_ID="$2"
CHAIN_1_ID="$3"
SETUP_CHAINS="$(dirname "$0")/setup-chains"
INIT_CLIENTS="$(dirname "$0")/init-hermes"
"$SETUP_CHAINS" "$CHAIN_0_ID" "$CHAIN_1_ID" "$CHAIN_2_ID" "$NON_INTERACTIVE"
"$INIT_CLIENTS" "$CONFIG_FILE" "$CHAIN_0_ID" "$CHAIN_1_ID" "$CHAIN_2_ID"