From 08a57fa8df75f551be1795c74bee89e2c601b0f3 Mon Sep 17 00:00:00 2001 From: durch Date: Mon, 15 Jan 2024 10:25:51 +0100 Subject: [PATCH] Check that we are running fromt the scripts dir --- scripts/localnet_start.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/localnet_start.sh b/scripts/localnet_start.sh index ac2a059547..9b2d93475e 100755 --- a/scripts/localnet_start.sh +++ b/scripts/localnet_start.sh @@ -2,6 +2,15 @@ set -o errexit +# check that current folder ends with scripts +current_folder=$(basename "$(pwd)") + +# Check if the current folder ends with "scripts" +if [[ $current_folder != *scripts ]]; then + echo "Please run this from the 'scripts' folder" + exit +fi + # can't just use `mktemp` since syntax differs between linux and macos (thx apple) suffix=$(openssl rand -base64 10 | tr -dc 'a-zA-Z0-9') localnetdir="$HOME/.nym/localnets/localnet.$suffix" @@ -11,16 +20,16 @@ echo "Using $localnetdir for the localnet" # initialise mixnet echo "initialising mixnode1..." -cargo run --release --bin nym-mixnode -- init --id "mix1-$suffix" --host 127.0.0.1 --mix-port 10001 --verloc-port 20001 --http-api-port 30001 --output=json >> "$localnetdir/mix1.json" +cargo run --release --bin nym-mixnode -- init --id "mix1-$suffix" --host 127.0.0.1 --mix-port 10001 --verloc-port 20001 --http-api-port 30001 --output=json >>"$localnetdir/mix1.json" echo "initialising mixnode2..." -cargo run --release --bin nym-mixnode -- init --id "mix2-$suffix" --host 127.0.0.1 --mix-port 10002 --verloc-port 20002 --http-api-port 30002 --output=json >> "$localnetdir/mix2.json" +cargo run --release --bin nym-mixnode -- init --id "mix2-$suffix" --host 127.0.0.1 --mix-port 10002 --verloc-port 20002 --http-api-port 30002 --output=json >>"$localnetdir/mix2.json" echo "initialising mixnode3..." -cargo run --release --bin nym-mixnode -- init --id "mix3-$suffix" --host 127.0.0.1 --mix-port 10003 --verloc-port 20003 --http-api-port 30003 --output=json >> "$localnetdir/mix3.json" +cargo run --release --bin nym-mixnode -- init --id "mix3-$suffix" --host 127.0.0.1 --mix-port 10003 --verloc-port 20003 --http-api-port 30003 --output=json >>"$localnetdir/mix3.json" echo "initialising gateway..." -cargo run --release --bin nym-gateway -- init --id "gateway-$suffix" --host 127.0.0.1 --mix-port 10004 --clients-port 9000 --output=json >> "$localnetdir/gateway.json" +cargo run --release --bin nym-gateway -- init --id "gateway-$suffix" --host 127.0.0.1 --mix-port 10004 --clients-port 9000 --output=json >>"$localnetdir/gateway.json" # build the topology echo "combining json files..." @@ -47,7 +56,7 @@ echo "nym-gateway launched" # initialise the clients echo "initialising network requester..." -cargo run --release --bin nym-network-requester -- init --id "network-requester-$suffix" --open-proxy=true --custom-mixnet "$networkfile" --output=json >> "$localnetdir/network_requester.json" +cargo run --release --bin nym-network-requester -- init --id "network-requester-$suffix" --open-proxy=true --custom-mixnet "$networkfile" --output=json >>"$localnetdir/network_requester.json" address=$(jq -r .client_address "$localnetdir/network_requester.json") echo "initialising socks5 client..."