solana/multinode-demo/wallet.sh

36 lines
850 B
Bash
Raw Normal View History

#!/bin/bash
#
# usage: $0 <rsync network path to solana repo on leader machine>"
#
here=$(dirname "$0")
2018-06-26 23:15:43 -07:00
# shellcheck source=multinode-demo/common.sh
source "$here"/common.sh
2018-07-02 13:49:21 -07:00
SOLANA_CONFIG_DIR=config-client
2018-07-02 11:58:01 -07:00
# if $1 isn't host:path or some local path
if [[ ${1%:} != "$1" || -d $1 ]]; then
leader=$1 # interpret
shift
else
leader=$here/.. # Default to local solana repo
fi
rsync_leader_url=$(rsync_url "$leader")
2018-07-02 10:54:35 -07:00
set -e
mkdir -p $SOLANA_CONFIG_DIR
2018-07-02 10:54:35 -07:00
if [[ ! -r $SOLANA_CONFIG_DIR/leader.json ]]; then
rsync -vPz "$rsync_leader_url"/config/leader.json $SOLANA_CONFIG_DIR/
fi
2018-06-29 22:56:23 -07:00
client_json=$SOLANA_CONFIG_DIR/client.json
if [[ ! -r $client_json ]]; then
$solana_mint <<<0 > $client_json
fi
2018-07-02 10:54:35 -07:00
set -x
2018-06-29 09:16:20 -07:00
# shellcheck disable=SC2086 # $solana_wallet should not be quoted
exec $solana_wallet \
2018-06-29 22:56:23 -07:00
-l $SOLANA_CONFIG_DIR/leader.json -m $client_json "$@"