3
3
set -e
4
4
5
5
if [ " $DEBUG " = " 1" ]; then
6
- set -x
6
+ set -x
7
7
fi
8
8
9
9
if [ " $ALGORAND_DATA " != " /algod/data" ]; then
10
- echo " Do not override 'ALGORAND_DATA' environment variable."
11
- exit 1
10
+ echo " Do not override 'ALGORAND_DATA' environment variable."
11
+ exit 1
12
12
fi
13
13
14
- # To allow mounting the data directory we need to change permissions
15
- # to our algorand user. The script is initially run as the root user
16
- # in order to change permissions, afterwards the script is re-launched
17
- # as the algorand user.
18
- if [ " $( id -u) " = ' 0' ]; then
19
- chown -R algorand:algorand " $ALGORAND_DATA "
20
- exec su -p -c " $( readlink -f $0 ) $@ " algorand
21
- fi
22
-
23
-
24
14
# Configure the participation node
25
15
if [ -d " $ALGORAND_DATA " ]; then
26
- if [ " $TOKEN " != " " ]; then
27
- echo " $TOKEN " > " $ALGORAND_DATA /algod.token"
28
- fi
29
- if [ " $ADMIN_TOKEN " != " " ]; then
30
- echo " $ADMIN_TOKEN " > " $ALGORAND_DATA /algod.admin.token"
31
- fi
32
- cd " $ALGORAND_DATA "
33
- cp " /node/run/genesis/testnet/genesis.json" genesis.json
34
- algocfg profile set --yes -d " $ALGORAND_DATA " " participation"
35
- algod -o -d $ALGORAND_DATA -l " 0.0.0.0:8080"
16
+ if [ -f " $ALGORAND_DATA /genesis.json" ]; then
17
+ if [ " $TOKEN " != " " ]; then
18
+ echo " $TOKEN " > " $EMPTY_DATA /algod.token"
19
+ fi
20
+ if [ " $ADMIN_TOKEN " != " " ]; then
21
+ echo " $ADMIN_TOKEN " > " $EMPTY_DATA /algod.admin.token"
22
+ fi
23
+ algod -o -d " $ALGORAND_DATA " -l " 0.0.0.0:8080"
24
+ else
25
+ sed -i " s/NUM_ROUNDS/${NUM_ROUNDS:- 30000} /" " /node/run/template.json"
26
+ sed -i " s/\" NetworkName\" : \"\" /\" NetworkName\" : \" hack-tui\" /" " /node/run/template.json"
27
+ goal network create --noclean -n tuinet -r " ${ALGORAND_DATA} /.." -t " /node/run/template.json"
28
+
29
+ # Cycle Network
30
+ goal network start -r " ${ALGORAND_DATA} /.."
31
+ goal node stop
32
+
33
+ # Update Tokens
34
+ if [ " $TOKEN " != " " ]; then
35
+ echo " $TOKEN " > " $ALGORAND_DATA /algod.token"
36
+ fi
37
+ if [ " $ADMIN_TOKEN " != " " ]; then
38
+ echo " $ADMIN_TOKEN " > " $ALGORAND_DATA /algod.admin.token"
39
+ fi
40
+ # Import wallet
41
+ goal account import -m " artefact exist coil life turtle edge edge inside punch glance recycle teach melody diet method pause slam dumb race interest amused side learn able heavy"
42
+
43
+ algod -o -d " $ALGORAND_DATA " -l " 0.0.0.0:8080"
44
+ fi
45
+
36
46
else
37
- echo " $ALGORAND_DATA " does not exist
38
- exit 1
39
- fi
47
+ echo " $ALGORAND_DATA " does not exist
48
+ exit 1
49
+ fi
0 commit comments