-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerateartifacts.sh
70 lines (45 loc) · 2.06 KB
/
generateartifacts.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash -e
export PWD=`pwd`
export FABRIC_CFG_PATH=$PWD
export ARCH=$(uname -s)
export CRYPTOGEN=$PWD/bin/cryptogen
export CONFIGTXGEN=$PWD/bin/configtxgen
function generateArtifacts() {
echo " *********** Generating artifacts ************ "
echo " *********** Deleting old certificates ******* "
rm -rf ./crypto-config
echo " ************ Generating certificates ********* "
$CRYPTOGEN generate --config=$FABRIC_CFG_PATH/crypto-config.yaml
echo " ************ Generating tx files ************ "
$CONFIGTXGEN -profile OrdererGenesis -outputBlock ./genesis.block
$CONFIGTXGEN -profile mangotracechannel -outputCreateChannelTx ./mangotracechannel.tx -channelID mangotracechannel
echo "Generating anchor peers tx files for APEDA"
$CONFIGTXGEN -profile mangotracechannel -outputAnchorPeersUpdate ./mangotracechannelAPEDAMSPAnchor.tx -channelID mangotracechannel -asOrg APEDAMSP
echo "Generating anchor peers tx files for Exporters"
$CONFIGTXGEN -profile mangotracechannel -outputAnchorPeersUpdate ./mangotracechannelExportersMSPAnchor.tx -channelID mangotracechannel -asOrg ExportersMSP
echo "Generating anchor peers tx files for Importers"
$CONFIGTXGEN -profile mangotracechannel -outputAnchorPeersUpdate ./mangotracechannelImportersMSPAnchor.tx -channelID mangotracechannel -asOrg ImportersMSP
}
function generateDockerComposeFile(){
OPTS="-i"
if [ "$ARCH" = "Darwin" ]; then
OPTS="-it"
fi
cp docker-compose-template.yaml docker-compose.yaml
cd crypto-config/peerOrganizations/apeda.gov.in/ca
PRIV_KEY=$(ls *_sk)
cd ../../../../
sed $OPTS "s/APEDA_PRIVATE_KEY/${PRIV_KEY}/g" docker-compose.yaml
cd crypto-config/peerOrganizations/importers.in/ca
PRIV_KEY=$(ls *_sk)
cd ../../../../
sed $OPTS "s/IMPORTERS_PRIVATE_KEY/${PRIV_KEY}/g" docker-compose.yaml
cd crypto-config/peerOrganizations/exporters.in/ca
PRIV_KEY=$(ls *_sk)
cd ../../../../
sed $OPTS "s/EXPORTERS_PRIVATE_KEY/${PRIV_KEY}/g" docker-compose.yaml
}
generateArtifacts
cd $PWD
generateDockerComposeFile
cd $PWD