Make network.sh more tolerant (#634)

The network.sh is dependent onbeing executed from the test-network directory
This PR makes it a little more tolerant, and will add a bin directgory based on the location
of the script - not just the PWD

Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
This commit is contained in:
Matthew B White 2022-02-08 11:08:59 +00:00 committed by GitHub
parent 35be8f7425
commit b50611575b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,10 +12,20 @@
#
# prepending $PWD/../bin to PATH to ensure we are picking up the correct binaries
# this may be commented out to resolve installed version of tools if desired
export PATH=${PWD}/../bin:$PATH
#
# However using PWD in the path has the side effect that location that
# this script is run from is critical. To ease this, get the directory
# this script is actually in and infer location from there. (putting first)
ROOTDIR=$(cd "$(dirname "$0")" && pwd)
export PATH=${ROOTDIR}/../bin:${PWD}/../bin:$PATH
export FABRIC_CFG_PATH=${PWD}/configtx
export VERBOSE=false
# push to the required directory & set a trap to go back if needed
pushd ${ROOTDIR} > /dev/null
trap "popd > /dev/null" EXIT
. scripts/utils.sh
# Obtain CONTAINER_IDS and remove them
@ -483,4 +493,3 @@ else
printHelp
exit 1
fi