forked from Arkivix/arkivix-efsn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-entrypoint-miner-local-gtw.sh
91 lines (71 loc) · 2.5 KB
/
docker-entrypoint-miner-local-gtw.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/sh
NODES_ROOT=/fusion-node
# NODES_ROOT=/Users/work/dev/tmp/fusion-node
DATA_DIR=$NODES_ROOT/data
KEYSTORE_DIR=$DATA_DIR/keystore
unlock=
ethstats=
autobt=false
display_usage() {
echo "Commands for Fusion efsn:"
echo -e "\n-e value Reporting name of a ethstats service"
echo -e "\n-u value Account to unlock"
echo -e "\n-a Auto buy tickets"
}
while [ "$1" != "" ]; do
case $1 in
-u | --unlock ) shift
unlock=$1
;;
-e | --ethstats ) shift
ethstats=$1
;;
-a | --autobt ) autobt=true
;;
* ) display_usage
exit 1
esac
shift
done
# create data folder if does not exit
if [ ! -d "$DATA_DIR" ]; then
mkdir $DATA_DIR
fi
# create keystore folder if does not exit
if [ ! -d "$KEYSTORE_DIR" ]; then
mkdir $KEYSTORE_DIR
fi
# copy keystore file
cp $NODES_ROOT/UTC* $KEYSTORE_DIR/
# format command option
cmd_options="--datadir $DATA_DIR --password /fusion-node/password.txt --mine"
# cmd_options_local_gtw=' --identity 1 --rpc --ws --rpcaddr 127.0.0.1 --rpccorsdomain 127.0.0.1 --wsapi "eth,net,fsn,fsntx" --rpcapi "eth,net,fsn,fsntx" --wsaddr 127.0.0.1 --wsport 9001 --rpcport 9000'
cmd_options_local_gtw=' --rpc --ws --rpcaddr 0.0.0.0 --rpccorsdomain 0.0.0.0 --wsapi="eth,net,fsn,fsntx" --rpcapi="eth,net,fsn,fsntx" --wsaddr 0.0.0.0 --wsport 9001 --wsorigins=* --rpcport 9000'
if [ "$ethstats" ]; then
ethstats=" --ethstats $ethstats:[email protected]"
cmd_options=$cmd_options$ethstats
fi
if [ "$unlock" ]; then
# pattern=$KEYSTORE_DIR/UTC*
# echo "pater: $pattern"
# keystore_files=($pattern)
# # for f in "${keystore_files[@]}"; do
# # echo "file: $f"
# # done
# echo "file: ${keystore_files[0]}"
# utc_json_address="$(cat < ${keystore_files[0]} | jq -r '.address')"
# echo "utc_json_address: $utc_json_address"
# if [ "$utc_json_address" = "$unlock" ]; then
# echo "$unlock is 'valid'"
# fi
# echo "unlock set to: $unlock"
unlock=" --unlock $unlock"
cmd_options=$cmd_options$unlock
fi
if [ "$autobt" = true ]; then
autobt=" --autobt"
cmd_options=$cmd_options$autobt
fi
echo "flags: $cmd_options$cmd_options_local_gtw"
# efsn --unlock $unlock --ethstats
eval "efsn $cmd_options$cmd_options_local_gtw"