fabric-samples/commercial-paper/organization/digibank/digibank.sh
Arnaud J Le Hors 3fbce62c01
Fix commercial paper org scripts (#362)
The current scripts given to setup the user environment do not work
on Mac:

$ . ./magnetocorp.sh
-bash: cd: /Users/lehors/Projects/Go/src/github.com/hyperledger/fabric-samples/commercial-paper/organization/magnetocorp
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed./../../../test-network: No such file or directory
-bash: ./scripts/envVar.sh: No such file or directory
[...truncated...]
export FABRIC_CFG_PATH="/Users/lehors/Projects/Go/src/github.com/hyperledger/fabric-samples/commercial-paper/organization/magnetocorp"
export PATH="/Users/lehors/Projects/Go/src/github.com/hyperledger/fabric-samples/commercial-paper/organization/magnetocorp"
export PEER_PARMS=""
Saving session...
Saving session...

The session history related output is actually captured when setting the environment variables:

$ echo $FABRIC_CFG_PATH
/Users/lehors/Projects/Go/src/github.com/hyperledger/fabric-samples/commercial-paper/organization/magnetocorp
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed./../../../config

With this simple change the scripts work:

$ echo $FABRIC_CFG_PATH
/Users/lehors/Projects/Go/src/github.com/hyperledger/fabric-samples/commercial-paper/organization/magnetocorp/../../../config

Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
2020-10-27 12:07:49 -04:00

39 lines
694 B
Bash
Executable file

#!/bin/bash
#
# SPDX-License-Identifier: Apache-2.0
#
shopt -s extglob
function _exit(){
printf "Exiting:%s\n" "$1"
exit -1
}
: ${CHANNEL_NAME:="mychannel"}
: ${DELAY:="3"}
: ${MAX_RETRY:="5"}
: ${VERBOSE:="false"}
# Where am I?
DIR=${PWD}
# Locate the test network
cd "${DIR}/../../../test-network"
env | sort > /tmp/env.orig
OVERRIDE_ORG="1"
. ./scripts/envVar.sh
parsePeerConnectionParameters 1 2
export PEER_PARMS="${PEER_CONN_PARMS##*( )}"
# set the fabric config path
export FABRIC_CFG_PATH="${DIR}/../../../config"
export PATH="${DIR}/../../../bin:${PWD}:$PATH"
env | sort | comm -1 -3 /tmp/env.orig - | sed -E 's/(.*)=(.*)/export \1="\2"/'
rm /tmp/env.orig
cd ${DIR}