github.com/FUSIONFoundation/efsn@v3.6.2-0.20200916075423-dbb5dd5d2cc7+incompatible/docker-entrypoint.sh (about) 1 #!/bin/sh 2 NODES_ROOT=/fusion-node 3 # NODES_ROOT=/Users/work/dev/tmp/fusion-node 4 DATA_DIR=$NODES_ROOT/data 5 KEYSTORE_DIR=$DATA_DIR/keystore 6 unlock= 7 ethstats= 8 testnet= 9 autobt=false 10 mining=true 11 12 display_usage() { 13 echo "Commands for Fusion efsn:" 14 echo -e "-e value Reporting name of a ethstats service" 15 echo -e "-u value Account to unlock" 16 echo -e "-a Auto buy tickets" 17 echo -e "-tn Connect to testnet" 18 } 19 20 while [ "$1" != "" ]; do 21 case $1 in 22 -u | --unlock ) shift 23 unlock=$1 24 ;; 25 -e | --ethstats ) shift 26 ethstats=$1 27 ;; 28 -tn | --testnet ) testnet=true 29 ;; 30 -a | --autobt ) autobt=true 31 ;; 32 --disable-mining ) mining=false 33 ;; 34 * ) display_usage 35 exit 1 36 esac 37 shift 38 done 39 40 # create data folder if does not exit 41 if [ ! -d "$DATA_DIR" ]; then 42 mkdir $DATA_DIR 43 fi 44 45 # create keystore folder if does not exit 46 if [ ! -d "$KEYSTORE_DIR" ]; then 47 mkdir $KEYSTORE_DIR 48 fi 49 50 # copy keystore file 51 cp $NODES_ROOT/UTC* $KEYSTORE_DIR/ 2>/dev/null 52 53 # format command option 54 cmd_options="--datadir $DATA_DIR --password /fusion-node/password.txt" 55 56 if [ "$testnet" ]; then 57 testnet=" --testnet" 58 cmd_options=$cmd_options$testnet 59 fi 60 61 if [ "$ethstats" ]; then 62 if [ "$testnet" ]; then 63 ethstats=" --ethstats $ethstats:devFusioInfo2019142@devnodestats.fusionnetwork.io" 64 else 65 ethstats=" --ethstats $ethstats:fsnMainnet@node.fusionnetwork.io" 66 fi 67 cmd_options=$cmd_options$ethstats 68 fi 69 70 if [ "$unlock" ]; then 71 72 # pattern=$KEYSTORE_DIR/UTC* 73 # echo "pater: $pattern" 74 75 # keystore_files=($pattern) 76 77 # # for f in "${keystore_files[@]}"; do 78 # # echo "file: $f" 79 # # done 80 81 # echo "file: ${keystore_files[0]}" 82 83 # utc_json_address="$(cat < ${keystore_files[0]} | jq -r '.address')" 84 # echo "utc_json_address: $utc_json_address" 85 86 # if [ "$utc_json_address" = "$unlock" ]; then 87 # echo "$unlock is 'valid'" 88 # fi 89 90 # echo "unlock set to: $unlock" 91 unlock=" --unlock $unlock" 92 cmd_options=$cmd_options$unlock 93 fi 94 95 if [ "$autobt" = true ]; then 96 autobt=" --autobt" 97 cmd_options=$cmd_options$autobt 98 fi 99 100 if [ "$mining" = true ]; then 101 mining=" --mine" 102 cmd_options=$cmd_options$mining 103 fi 104 105 echo "efsn flags: $cmd_options" 106 107 # efsn --unlock $unlock --ethstats 108 exec efsn $cmd_options