From 1c3ec7c65cdca5d6e5c45f3b12a993d5e1ab691f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Criado-P=C3=A9rez?= Date: Mon, 26 Jun 2023 17:26:31 +0200 Subject: [PATCH] Upgraded script to check both dependencies and display all missing ones at the same time --- scripts/README.md | 3 ++- scripts/cluster | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/scripts/README.md b/scripts/README.md index 4c65952327..e82c4cdc38 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -1,4 +1,4 @@ -# Run servers form local binary +# Run servers from local binary ## Prerequisites @@ -6,6 +6,7 @@ When deploying with `polybft` consensus, there are some additional dependencies: * [npm](https://nodejs.org/en/) * [go 1.19.x](https://go.dev/dl/) * [jq](https://jqlang.github.io/jq) +* Netcat (nc) ## Local development Running `polygon-edge` from local binary can be done very easily by using provided `scripts` folder. diff --git a/scripts/cluster b/scripts/cluster index 07b6669991..8ac9ffbe26 100755 --- a/scripts/cluster +++ b/scripts/cluster @@ -1,12 +1,26 @@ #!/usr/bin/env bash +dp_error_flag=0 + # Check if jq is installed if [[ "$1" == "polybft" ]] && ! command -v jq >/dev/null 2>&1; then - echo "jq is not installed. Please install it manually and run the script again." + echo "jq is not installed." echo "Manual installation instructions: Visit https://jqlang.github.io/jq/ for more information." - exit 1 + dp_error_flag=1 +fi + +# Check if nc is installed +if [[ "$1" == "polybft" ]] && ! command -v nc >/dev/null 2>&1; then + echo "Netcat (nc) is not installed." + dp_error_flag=1 fi +# Stop script if any of the dependencies have failed +if [[ "$dp_error_flag" -eq 1]]; then + echo "Missing dependencies. Please install them and run the script again." + exit 1 +fi + function initIbftConsensus() { echo "Running with ibft consensus" ./polygon-edge secrets init --insecure --data-dir test-chain- --num 4