-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathupgrade.sh
executable file
·171 lines (149 loc) · 3.97 KB
/
upgrade.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#!/bin/bash
VERSION_FILE=cc_version.txt
CURR_VERSION=`cat ${VERSION_FILE}`
VERSION=""
if [ -e ./script_functions.sh ]
then
echo "script_functions.sh found in current folder"
. ./script_functions.sh
else
echo "script_functions.sh not found in current folder. Execute via direct path..."
. ~/ubin-fabric-api/scripts/script_functions.sh
fi
starttime=$(date +%s)
isBilateral=false
isFunding=false
isNetting=false
while
case $1 in
-b | --bilateral )
isBilateral=true
;;
-f | --funding )
isFunding=true
;;
-n | --netting )
isNetting=true
;;
-v | --version )
shift
re='^[0-9]+$'
if ! [[ $1 =~ ${re} ]]
then
echo "$1 is not a valid integer" >&2
exit
elif [ $1 -gt ${CURR_VERSION} ]
then
VERSION=$1
echo "Upgrading to version ${VERSION}"
else
echo "Version specified ($1) must be greater than ${CURR_VERSION}" >&2
exit
fi
;;
* )
echo "Invalid option: $1"
echo "Usage: upgrade [-b] [-f] [-n] [-v version_number]"
echo " -b | --bilateral upgrades the bilateral channel chaincode"
echo " -f | --funding upgrades the funding channel chaincode"
echo " -n | --netting upgrades the netting channel chaincode"
echo " -v | --version requires the user to specify a version number (integer)"
exit
;;
esac
shift
[ "$1" != "" ]
do :; done
if [ -z ${VERSION} ]; then
VERSION=$((CURR_VERSION+1))
echo "No version defined, upgrading to version ${VERSION}"
fi
echo ${VERSION} > cc_version.txt
# =======================================
# CHAINCODE INSTALLATION
# =======================================
if [ ${isBilateral} = true ]
then
Install bilateralchannel
fi
if [ ${isFunding} = true ]
then
Install fundingchannel
fi
if [ ${isNetting} = true ]
then
Install nettingchannel
fi
# =======================================
# CHAINCODE UPGRADE
# =======================================
if [ ${ORG_NAME} = ${REGULATOR_ORG} ]
then
sleep 20
if [ ${isBilateral} = true ]
then
Upgrade bofasg2xchassgsgchannel
Upgrade bofasg2xcitisgsgchannel
Upgrade bofasg2xcsfbsgsxchannel
Upgrade bofasg2xdbsssgsgchannel
Upgrade bofasg2xhsbcsgsgchannel
Upgrade bofasg2xmtbcsgsgchannel
Upgrade bofasg2xocbcsgsgchannel
Upgrade bofasg2xscblsgsgchannel
Upgrade bofasg2xuobvsgsgchannel
Upgrade bofasg2xxsimsgsgchannel
Upgrade chassgsgcitisgsgchannel
Upgrade chassgsgcsfbsgsxchannel
Upgrade chassgsgdbsssgsgchannel
Upgrade chassgsghsbcsgsgchannel
Upgrade chassgsgmtbcsgsgchannel
Upgrade chassgsgocbcsgsgchannel
Upgrade chassgsgscblsgsgchannel
Upgrade chassgsguobvsgsgchannel
Upgrade chassgsgxsimsgsgchannel
Upgrade citisgsgcsfbsgsxchannel
Upgrade citisgsgdbsssgsgchannel
Upgrade citisgsghsbcsgsgchannel
Upgrade citisgsgmtbcsgsgchannel
Upgrade citisgsgocbcsgsgchannel
Upgrade citisgsgscblsgsgchannel
Upgrade citisgsguobvsgsgchannel
Upgrade citisgsgxsimsgsgchannel
Upgrade csfbsgsxdbsssgsgchannel
Upgrade csfbsgsxhsbcsgsgchannel
Upgrade csfbsgsxmtbcsgsgchannel
Upgrade csfbsgsxocbcsgsgchannel
Upgrade csfbsgsxscblsgsgchannel
Upgrade csfbsgsxuobvsgsgchannel
Upgrade csfbsgsxxsimsgsgchannel
Upgrade dbsssgsghsbcsgsgchannel
Upgrade dbsssgsgmtbcsgsgchannel
Upgrade dbsssgsgocbcsgsgchannel
Upgrade dbsssgsgscblsgsgchannel
Upgrade dbsssgsguobvsgsgchannel
Upgrade dbsssgsgxsimsgsgchannel
Upgrade hsbcsgsgmtbcsgsgchannel
Upgrade hsbcsgsgocbcsgsgchannel
Upgrade hsbcsgsgscblsgsgchannel
Upgrade hsbcsgsguobvsgsgchannel
Upgrade hsbcsgsgxsimsgsgchannel
Upgrade mtbcsgsgocbcsgsgchannel
Upgrade mtbcsgsgscblsgsgchannel
Upgrade mtbcsgsguobvsgsgchannel
Upgrade mtbcsgsgxsimsgsgchannel
Upgrade ocbcsgsgscblsgsgchannel
Upgrade ocbcsgsguobvsgsgchannel
Upgrade ocbcsgsgxsimsgsgchannel
Upgrade scblsgsguobvsgsgchannel
Upgrade scblsgsgxsimsgsgchannel
Upgrade uobvsgsgxsimsgsgchannel
fi
if [ ${isFunding} = true ]
then
Upgrade fundingchannel
fi
if [ ${isNetting} = true ]
then
Upgrade nettingchannel
fi
fi