fabric-samples/first-network/scripts/step1org3.sh
Jason Yellick b5d50265e4 FAB-14633 Remove apt-get from eyfn.sh
The tools and fabric images are all alpine based now and do not have
apt-get.  Instead, they are prepopulated with jq.  This CR simply
removes the attempt to install jq (which always fails) and acts as a
red-herring when trying to debug.

Change-Id: I8fe83dc4a9ba6995ebfb2786cee45fe0e591b85a
Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
2019-03-13 14:02:09 -04:00

74 lines
2.1 KiB
Bash
Executable file

#!/bin/bash
#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# This script is designed to be run in the org3cli container as the
# first step of the EYFN tutorial. It creates and submits a
# configuration transaction to add org3 to the network previously
# setup in the BYFN tutorial.
#
CHANNEL_NAME="$1"
DELAY="$2"
LANGUAGE="$3"
TIMEOUT="$4"
VERBOSE="$5"
: ${CHANNEL_NAME:="mychannel"}
: ${DELAY:="3"}
: ${LANGUAGE:="golang"}
: ${TIMEOUT:="10"}
: ${VERBOSE:="false"}
LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]`
COUNTER=1
MAX_RETRY=5
if [ "$LANGUAGE" = "node" ]; then
CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/node/"
elif [ "$LANGUAGE" = "java" ]; then
CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/"
else
CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/"
fi
# import utils
. scripts/utils.sh
echo
echo "========= Creating config transaction to add org3 to network =========== "
echo
# Fetch the config for the channel, writing it to config.json
fetchChannelConfig ${CHANNEL_NAME} config.json
# Modify the configuration to append the new org
set -x
jq -s '.[0] * {"channel_group":{"groups":{"Application":{"groups": {"Org3MSP":.[1]}}}}}' config.json ./channel-artifacts/org3.json > modified_config.json
set +x
# Compute a config update, based on the differences between config.json and modified_config.json, write it as a transaction to org3_update_in_envelope.pb
createConfigUpdate ${CHANNEL_NAME} config.json modified_config.json org3_update_in_envelope.pb
echo
echo "========= Config transaction to add org3 to network created ===== "
echo
echo "Signing config transaction"
echo
signConfigtxAsPeerOrg 1 org3_update_in_envelope.pb
echo
echo "========= Submitting transaction from a different peer (peer0.org2) which also signs it ========= "
echo
setGlobals 0 2
set -x
peer channel update -f org3_update_in_envelope.pb -c ${CHANNEL_NAME} -o orderer.example.com:7050 --tls --cafile ${ORDERER_CA}
set +x
echo
echo "========= Config transaction to add org3 to network submitted! =========== "
echo
exit 0