2018-06-18 15:23:56 -07:00
|
|
|
#!/bin/bash
|
2018-06-24 10:10:55 -07:00
|
|
|
|
2018-06-23 11:52:12 -07:00
|
|
|
here=$(dirname "$0")
|
2018-06-24 10:10:55 -07:00
|
|
|
# shellcheck source=multinode-demo/common.sh
|
|
|
|
source "$here"/common.sh
|
2018-06-23 11:52:12 -07:00
|
|
|
|
2018-06-28 16:08:59 -07:00
|
|
|
usage () {
|
|
|
|
cat <<EOF
|
2018-06-29 16:49:23 -07:00
|
|
|
usage: $0 [-n num_tokens] [-l] [-p]
|
2018-06-28 16:08:59 -07:00
|
|
|
|
|
|
|
Creates a fullnode configuration
|
|
|
|
|
2018-06-29 16:49:23 -07:00
|
|
|
-n num_tokens - Number of tokens to create
|
|
|
|
-l - Detect network address from local machine configuration, which
|
|
|
|
may be a private IP address unaccessible on the Intenet (default)
|
|
|
|
-p - Detect public address using public Internet servers
|
2018-06-28 16:08:59 -07:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2018-06-29 16:49:23 -07:00
|
|
|
ip_address_arg=-l
|
|
|
|
num_tokens=1000000000
|
|
|
|
while getopts "h?n:lp" opt; do
|
2018-06-28 16:08:59 -07:00
|
|
|
case $opt in
|
|
|
|
h|\?)
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
2018-06-29 16:49:23 -07:00
|
|
|
l)
|
|
|
|
ip_address_arg=-l
|
|
|
|
;;
|
2018-06-28 16:08:59 -07:00
|
|
|
p)
|
2018-06-29 16:49:23 -07:00
|
|
|
ip_address_arg=-p
|
2018-06-28 16:08:59 -07:00
|
|
|
;;
|
|
|
|
n)
|
|
|
|
num_tokens="$OPTARG"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
|
2018-06-29 16:49:23 -07:00
|
|
|
leader_address_args=("$ip_address_arg")
|
|
|
|
validator_address_args=("$ip_address_arg" -b 9000)
|
2018-06-28 16:08:59 -07:00
|
|
|
|
2018-06-24 10:10:55 -07:00
|
|
|
set -e
|
2018-06-18 15:23:56 -07:00
|
|
|
|
2018-06-24 10:10:55 -07:00
|
|
|
echo "Cleaning $SOLANA_CONFIG_DIR"
|
2018-07-02 07:49:14 -07:00
|
|
|
(
|
|
|
|
set -x
|
|
|
|
rm -rvf "$SOLANA_CONFIG_DIR"{,-private}
|
|
|
|
mkdir -p "$SOLANA_CONFIG_DIR"{,-private}
|
|
|
|
)
|
2018-06-18 15:23:56 -07:00
|
|
|
|
2018-06-27 13:53:01 -06:00
|
|
|
echo "Creating $SOLANA_CONFIG_DIR/mint.json with $num_tokens tokens"
|
2018-07-02 07:49:14 -07:00
|
|
|
$solana_mint <<<"$num_tokens" > "$SOLANA_CONFIG_DIR"-private/mint.json
|
2018-06-24 10:10:55 -07:00
|
|
|
|
|
|
|
echo "Creating $SOLANA_CONFIG_DIR/genesis.log"
|
2018-07-02 07:49:14 -07:00
|
|
|
$solana_genesis < "$SOLANA_CONFIG_DIR"-private/mint.json > "$SOLANA_CONFIG_DIR"/genesis.log
|
2018-06-24 10:10:55 -07:00
|
|
|
|
|
|
|
echo "Creating $SOLANA_CONFIG_DIR/leader.json"
|
2018-06-28 16:08:59 -07:00
|
|
|
$solana_fullnode_config "${leader_address_args[@]}" > "$SOLANA_CONFIG_DIR"/leader.json
|
2018-06-18 15:23:56 -07:00
|
|
|
|
2018-06-24 10:10:55 -07:00
|
|
|
echo "Creating $SOLANA_CONFIG_DIR/validator.json"
|
2018-06-28 16:08:59 -07:00
|
|
|
$solana_fullnode_config "${validator_address_args[@]}" > "$SOLANA_CONFIG_DIR"/validator.json
|
2018-06-22 11:37:42 -07:00
|
|
|
|
2018-06-24 10:10:55 -07:00
|
|
|
ls -lh "$SOLANA_CONFIG_DIR/"
|