forked from IBM/build-blockchain-insurance-app
-
Notifications
You must be signed in to change notification settings - Fork 2
/
ibm_fabric.sh
113 lines (103 loc) · 5.24 KB
/
ibm_fabric.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/sh
set -e
echo
echo "#################################################################"
echo "####### Generating cryptographic material ##########"
echo "#################################################################"
PROJPATH=$(pwd)
CLIPATH=$PROJPATH/cli/peers
ORDERERS=$CLIPATH/ordererOrganizations
PEERS=$CLIPATH/peerOrganizations
rm -rf $CLIPATH
$PROJPATH/cryptogen generate --config=$PROJPATH/crypto-config.yaml --output=$CLIPATH
sh generate-cfgtx.sh
# rm -rf $PROJPATH/{orderer,insurancePeer,policePeer,repairShopPeer,shopPeer}/crypto
rm -rf $PROJPATH/orderer/crypto
rm -rf $PROJPATH/insurancePeer/crypto
rm -rf $PROJPATH/policePeer/crypto
rm -rf $PROJPATH/repairShopPeer/crypto
rm -rf $PROJPATH/shopPeer/crypto
# mkdir $PROJPATH/{orderer,insurancePeer,policePeer,repairShopPeer,shopPeer}/crypto
mkdir $PROJPATH/orderer/crypto
mkdir $PROJPATH/insurancePeer/crypto
mkdir $PROJPATH/policePeer/crypto
mkdir $PROJPATH/repairShopPeer/crypto
mkdir $PROJPATH/shopPeer/crypto
# cp -r $ORDERERS/orderer-org/orderers/orderer0/{msp,tls} $PROJPATH/orderer/crypto
cp -r $ORDERERS/orderer-org/orderers/orderer0/msp $PROJPATH/orderer/crypto
cp -r $ORDERERS/orderer-org/orderers/orderer0/tls $PROJPATH/orderer/crypto
# cp -r $PEERS/insurance-org/peers/insurance-peer/{msp,tls} $PROJPATH/insurancePeer/crypto
cp -r $PEERS/insurance-org/peers/insurance-peer/msp $PROJPATH/insurancePeer/crypto
cp -r $PEERS/insurance-org/peers/insurance-peer/tls $PROJPATH/insurancePeer/crypto
# cp -r $PEERS/police-org/peers/police-peer/{msp,tls} $PROJPATH/policePeer/crypto
cp -r $PEERS/police-org/peers/police-peer/msp $PROJPATH/policePeer/crypto
cp -r $PEERS/police-org/peers/police-peer/tls $PROJPATH/policePeer/crypto
# cp -r $PEERS/repairshop-org/peers/repairshop-peer/{msp,tls} $PROJPATH/repairShopPeer/crypto
cp -r $PEERS/repairshop-org/peers/repairshop-peer/msp $PROJPATH/repairShopPeer/crypto
cp -r $PEERS/repairshop-org/peers/repairshop-peer/tls $PROJPATH/repairShopPeer/crypto
# cp -r $PEERS/shop-org/peers/shop-peer/{msp,tls} $PROJPATH/shopPeer/crypto
cp -r $PEERS/shop-org/peers/shop-peer/msp $PROJPATH/shopPeer/crypto
cp -r $PEERS/shop-org/peers/shop-peer/tls $PROJPATH/shopPeer/crypto
cp $CLIPATH/genesis.block $PROJPATH/orderer/crypto/
INSURANCECAPATH=$PROJPATH/insuranceCA
POLICECAPATH=$PROJPATH/policeCA
REPAIRSHOPCAPATH=$PROJPATH/repairShopCA
SHOPCAPATH=$PROJPATH/shopCA
# rm -rf {$INSURANCECAPATH,$POLICECAPATH,$REPAIRSHOPCAPATH,$SHOPCAPATH}/{ca,tls}
rm -rf $INSURANCECAPATH/ca
rm -rf $POLICECAPATH/ca
rm -rf $REPAIRSHOPCAPATH/ca
rm -rf $SHOPCAPATH/ca
rm -rf $INSURANCECAPATH/tls
rm -rf $POLICECAPATH/tls
rm -rf $REPAIRSHOPCAPATH/tls
rm -rf $SHOPCAPATH/tls
# mkdir -p {$INSURANCECAPATH,$POLICECAPATH,$REPAIRSHOPCAPATH,$SHOPCAPATH}/{ca,tls}
mkdir -p $INSURANCECAPATH/ca
mkdir -p $POLICECAPATH/ca
mkdir -p $REPAIRSHOPCAPATH/ca
mkdir -p $SHOPCAPATH/ca
mkdir -p $INSURANCECAPATH/tls
mkdir -p $POLICECAPATH/tls
mkdir -p $REPAIRSHOPCAPATH/tls
mkdir -p $SHOPCAPATH/tls
cp $PEERS/insurance-org/ca/* $INSURANCECAPATH/ca
cp $PEERS/insurance-org/tlsca/* $INSURANCECAPATH/tls
mv $INSURANCECAPATH/ca/*_sk $INSURANCECAPATH/ca/key.pem
mv $INSURANCECAPATH/ca/*-cert.pem $INSURANCECAPATH/ca/cert.pem
mv $INSURANCECAPATH/tls/*_sk $INSURANCECAPATH/tls/key.pem
mv $INSURANCECAPATH/tls/*-cert.pem $INSURANCECAPATH/tls/cert.pem
cp $PEERS/police-org/ca/* $POLICECAPATH/ca
cp $PEERS/police-org/tlsca/* $POLICECAPATH/tls
mv $POLICECAPATH/ca/*_sk $POLICECAPATH/ca/key.pem
mv $POLICECAPATH/ca/*-cert.pem $POLICECAPATH/ca/cert.pem
mv $POLICECAPATH/tls/*_sk $POLICECAPATH/tls/key.pem
mv $POLICECAPATH/tls/*-cert.pem $POLICECAPATH/tls/cert.pem
cp $PEERS/repairshop-org/ca/* $REPAIRSHOPCAPATH/ca
cp $PEERS/repairshop-org/tlsca/* $REPAIRSHOPCAPATH/tls
mv $REPAIRSHOPCAPATH/ca/*_sk $REPAIRSHOPCAPATH/ca/key.pem
mv $REPAIRSHOPCAPATH/ca/*-cert.pem $REPAIRSHOPCAPATH/ca/cert.pem
mv $REPAIRSHOPCAPATH/tls/*_sk $REPAIRSHOPCAPATH/tls/key.pem
mv $REPAIRSHOPCAPATH/tls/*-cert.pem $REPAIRSHOPCAPATH/tls/cert.pem
cp $PEERS/shop-org/ca/* $SHOPCAPATH/ca
cp $PEERS/shop-org/tlsca/* $SHOPCAPATH/tls
mv $SHOPCAPATH/ca/*_sk $SHOPCAPATH/ca/key.pem
mv $SHOPCAPATH/ca/*-cert.pem $SHOPCAPATH/ca/cert.pem
mv $SHOPCAPATH/tls/*_sk $SHOPCAPATH/tls/key.pem
mv $SHOPCAPATH/tls/*-cert.pem $SHOPCAPATH/tls/cert.pem
WEBCERTS=$PROJPATH/web/certs
rm -rf $WEBCERTS
mkdir -p $WEBCERTS
cp $PROJPATH/orderer/crypto/tls/ca.crt $WEBCERTS/ordererOrg.pem
cp $PROJPATH/insurancePeer/crypto/tls/ca.crt $WEBCERTS/insuranceOrg.pem
cp $PROJPATH/policePeer/crypto/tls/ca.crt $WEBCERTS/policeOrg.pem
cp $PROJPATH/repairShopPeer/crypto/tls/ca.crt $WEBCERTS/repairShopOrg.pem
cp $PROJPATH/shopPeer/crypto/tls/ca.crt $WEBCERTS/shopOrg.pem
cp $PEERS/insurance-org/users/Admin@insurance-org/msp/keystore/* $WEBCERTS/[email protected]
cp $PEERS/insurance-org/users/Admin@insurance-org/msp/signcerts/* $WEBCERTS/
cp $PEERS/shop-org/users/Admin@shop-org/msp/keystore/* $WEBCERTS/[email protected]
cp $PEERS/shop-org/users/Admin@shop-org/msp/signcerts/* $WEBCERTS/
cp $PEERS/police-org/users/Admin@police-org/msp/keystore/* $WEBCERTS/[email protected]
cp $PEERS/police-org/users/Admin@police-org/msp/signcerts/* $WEBCERTS/
cp $PEERS/repairshop-org/users/Admin@repairshop-org/msp/keystore/* $WEBCERTS/[email protected]
cp $PEERS/repairshop-org/users/Admin@repairshop-org/msp/signcerts/* $WEBCERTS/