From 30141537e1d874b0267b66172d8e178b68c1d732 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Fri, 12 Jul 2024 09:38:36 -0600 Subject: [PATCH] Use config file in all scripts --- scripts/02-init-network-dirs.sh | 8 +++----- scripts/03-merge-genesis-txns.sh | 7 +++---- scripts/04-create-deployments.sh | 6 +++--- scripts/delete-deployments.sh | 6 +++--- scripts/delete-network-dirs.sh | 6 +++--- scripts/lib.sh | 2 ++ scripts/network.cfg | 2 ++ 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/scripts/02-init-network-dirs.sh b/scripts/02-init-network-dirs.sh index ca7474a..acce500 100755 --- a/scripts/02-init-network-dirs.sh +++ b/scripts/02-init-network-dirs.sh @@ -4,6 +4,9 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then set -x fi +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +source ${SCRIPT_DIR}/lib.sh + if [[ -n "$1" ]]; then machine_name_prefix=$1 else @@ -11,11 +14,6 @@ else exit 1 fi -machine_domain=borgboxes.network -node_count=4 -node_network_dir=testnet-dir -chain_id=laconic_81337-6 - echo "Initializing network dirs on all nodes" for (( i=1 ; i<=$node_count ; i++ )); do diff --git a/scripts/03-merge-genesis-txns.sh b/scripts/03-merge-genesis-txns.sh index 20a5818..b285993 100755 --- a/scripts/03-merge-genesis-txns.sh +++ b/scripts/03-merge-genesis-txns.sh @@ -4,6 +4,9 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then set -x fi +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +source ${SCRIPT_DIR}/lib.sh + if [[ -n "$1" ]]; then machine_name_prefix=$1 else @@ -11,10 +14,6 @@ else exit 1 fi -machine_domain=borgboxes.network -node_count=4 -node_network_dir=testnet-dir -chain_id=laconic_81337-6a p2p_port="26656" so_command=/home/laconic/bin/laconic-so diff --git a/scripts/04-create-deployments.sh b/scripts/04-create-deployments.sh index 7514d62..0c17743 100755 --- a/scripts/04-create-deployments.sh +++ b/scripts/04-create-deployments.sh @@ -4,6 +4,9 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then set -x fi +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +source ${SCRIPT_DIR}/lib.sh + usage="Usage: $0 " if [[ -n "$1" ]]; then @@ -20,9 +23,6 @@ else exit 1 fi -machine_domain=borgboxes.network -node_count=4 -node_network_dir=testnet-dir so_command=/home/laconic/bin/laconic-so echo "Run deploy init on all nodes" diff --git a/scripts/delete-deployments.sh b/scripts/delete-deployments.sh index 029849b..4203bb2 100755 --- a/scripts/delete-deployments.sh +++ b/scripts/delete-deployments.sh @@ -4,6 +4,9 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then set -x fi +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +source ${SCRIPT_DIR}/lib.sh + if [[ -n "$1" ]]; then machine_name_prefix=$1 else @@ -11,9 +14,6 @@ else exit 1 fi -machine_domain=borgboxes.network -node_count=4 -node_network_dir=testnet-dir so_command=/home/laconic/bin/laconic-so echo "Delete deployment dirs on all nodes" diff --git a/scripts/delete-network-dirs.sh b/scripts/delete-network-dirs.sh index 3e33666..88d6311 100755 --- a/scripts/delete-network-dirs.sh +++ b/scripts/delete-network-dirs.sh @@ -4,6 +4,9 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then set -x fi +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +source ${SCRIPT_DIR}/lib.sh + if [[ -n "$1" ]]; then machine_name_prefix=$1 else @@ -11,9 +14,6 @@ else exit 1 fi -machine_domain=borgboxes.network -node_count=4 -node_network_dir=testnet-dir local_gentx_dir=gentx-${machine_name_prefix} echo "Deleting network dirs on all nodes" diff --git a/scripts/lib.sh b/scripts/lib.sh index de89d1a..1c5baa3 100644 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -21,6 +21,8 @@ source ${network_config_file} assert_defined "machine_domain" assert_defined "node_count" assert_defined "ssh_user" +assert_defined "node_network_dir" +assert_defined "chain_id" # Hack until we fix PATH for remote sessions so_command=/home/laconic/bin/laconic-so diff --git a/scripts/network.cfg b/scripts/network.cfg index 58e04bd..6d5ab5d 100644 --- a/scripts/network.cfg +++ b/scripts/network.cfg @@ -1,3 +1,5 @@ machine_domain=borgboxes.network node_count=4 ssh_user=laconic +node_network_dir=testnet-dir +chain_id=laconic_81337-6