docker-compose-files/hyperledger_fabric/v1.3.0/scripts/gen_cryptoArtifacts.sh

34 lines
842 B
Bash
Raw Normal View History

2018-10-11 13:53:01 +08:00
#!/usr/bin/env bash
2018-10-12 11:33:24 +08:00
# use /tmp/crypto-config.yaml to generate /tmp/crypto-config
# use /tmp/org3/crypto-config.yaml to generate /tmp/org3/crypto-config
2018-10-11 13:53:01 +08:00
cd /tmp # we use /tmp as the base working path
# The crypto-config will be used by channel artifacts generation later
2018-10-12 11:33:24 +08:00
CRYPTO_CONFIG=crypto-config
2018-10-11 13:53:01 +08:00
echo "Generating crypto-config for org1 and org2..."
2018-10-12 11:33:24 +08:00
ls -l ${CRYPTO_CONFIG}
2018-10-11 13:53:01 +08:00
cryptogen generate \
--config=crypto-config.yaml \
2018-10-12 11:33:24 +08:00
--output ${CRYPTO_CONFIG}
2018-10-11 13:53:01 +08:00
if [ $? -ne 0 ]; then
2018-10-12 11:33:24 +08:00
echo "Failed to generate certificates for org1 and org2..."
2018-10-11 13:53:01 +08:00
exit 1
fi
echo "Generating crypto-config for org3..."
cryptogen generate \
--config=org3/crypto-config.yaml \
--output org3/${CRYPTO_CONFIG}
if [ $? -ne 0 ]; then
echo_r "Failed to generate certificates for org3..."
exit 1
fi
2018-10-12 11:33:24 +08:00
echo "Generated credential files and saved to ${CRYPTO_CONFIG}."