solana/multinode-demo/client.sh

32 lines
855 B
Bash
Raw Normal View History

#!/bin/bash
2018-06-24 10:10:55 -07:00
#
# usage: $0 <rsync network path to solana repo on leader machine> <number of nodes in the network>"
2018-06-24 10:10:55 -07:00
#
2018-05-27 18:19:07 -07:00
2018-06-24 10:10:55 -07:00
here=$(dirname "$0")
# shellcheck source=multinode-demo/common.sh
source "$here"/common.sh
2018-05-27 18:19:07 -07:00
2018-06-24 10:10:55 -07:00
leader=${1:-${here}/..} # Default to local solana repo
count=${2:-1}
2018-05-27 18:19:07 -07:00
rsync_leader_url=$(rsync_url "$leader")
2018-06-24 10:10:55 -07:00
set -ex
2018-07-02 17:08:39 -07:00
mkdir -p "$SOLANA_CONFIG_CLIENT_DIR"
if [[ ! -r "$SOLANA_CONFIG_CLIENT_DIR"/leader.json ]]; then
(
set -x
$rsync -vPz "$rsync_leader_url"/config/leader.json "$SOLANA_CONFIG_CLIENT_DIR"/
)
fi
client_json="$SOLANA_CONFIG_CLIENT_DIR"/client.json
if [[ ! -r $client_json ]]; then
2018-07-12 15:29:49 -07:00
$solana_keygen -o "$client_json"
fi
2018-06-24 10:10:55 -07:00
# shellcheck disable=SC2086 # $solana_client_demo should not be quoted
exec $solana_client_demo \
-n "$count" -l "$SOLANA_CONFIG_CLIENT_DIR"/leader.json -k "$SOLANA_CONFIG_CLIENT_DIR"/client.json