You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.3 KiB

  1. #! /bin/bash
  2. set -u
  3. N=$1 # number of nodes
  4. TESTNET=$2 # path to folder containing testnet info
  5. CONFIG=$3 # path to folder containing `bins` and `run.sh` files
  6. if [[ ! -f $CONFIG/bins ]]; then
  7. echo "config folder ($CONFIG) must contain bins file"
  8. exit 1
  9. fi
  10. if [[ ! -f $CONFIG/run.sh ]]; then
  11. echo "config folder ($CONFIG) must contain run.sh file"
  12. exit 1
  13. fi
  14. KEY=$HOME/.ssh/id_rsa
  15. FLAGS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
  16. N_=$((N-1)) # 0-based index
  17. MACH_ROOT="$TESTNET/mach?"
  18. # mkdir
  19. terraforce ssh --user root --ssh-key $KEY --machines "[0-$N_]" mkdir .tendermint
  20. # copy over genesis/priv_val
  21. terraforce scp --user root --ssh-key $KEY --iterative --machines "[0-$N_]" "$MACH_ROOT/priv_validator.json" .tendermint/priv_validator.json
  22. terraforce scp --user root --ssh-key $KEY --iterative --machines "[0-$N_]" "$MACH_ROOT/genesis.json" .tendermint/genesis.json
  23. # copy the run script
  24. terraforce scp --user root --ssh-key $KEY --machines "[0-$N_]" $CONFIG/run.sh run.sh
  25. # copy the binaries
  26. while read line; do
  27. local_bin=$(eval echo $line)
  28. remote_bin=$(basename $local_bin)
  29. echo $local_bin
  30. terraforce scp --user root --ssh-key $KEY --machines "[0-$N_]" $local_bin $remote_bin
  31. terraforce ssh --user root --ssh-key $KEY --machines "[0-$N_]" chmod +x $remote_bin
  32. done <$CONFIG/bins