@@ -27,38 +27,24 @@ printHelp() {
27
27
echo " would download docker images and binaries for version 1.4.4"
28
28
}
29
29
30
- # dockerFabricPull () pulls docker images from fabric and chaincode repositories
30
+ # dockerPull () pulls docker images from fabric and chaincode repositories
31
31
# note, if a docker image doesn't exist for a requested release, it will simply
32
32
# be skipped, since this script doesn't terminate upon errors.
33
- dockerFabricPull () {
34
- local FABRIC_TAG=$1
35
- for IMAGES in peer orderer ccenv tools baseos nodeenv javaenv; do
36
- echo " ==> FABRIC IMAGE: $IMAGES "
37
- echo
38
- docker pull " hyperledger/fabric-$IMAGES :$FABRIC_TAG "
39
- docker tag " hyperledger/fabric-$IMAGES :$FABRIC_TAG " " hyperledger/fabric-$IMAGES "
40
- done
41
- }
42
33
43
- dockerThirdPartyImagesPull () {
44
- local THIRDPARTY_TAG=$1
45
- for IMAGES in couchdb kafka zookeeper; do
46
- echo " ==> THIRDPARTY DOCKER IMAGE: $IMAGES "
47
- echo
48
- docker pull " hyperledger/fabric-$IMAGES :$THIRDPARTY_TAG "
49
- docker tag " hyperledger/fabric-$IMAGES :$THIRDPARTY_TAG " " hyperledger/fabric-$IMAGES "
34
+ dockerPull () {
35
+ image_tag=$1
36
+ shift
37
+ while [[ $# -gt 0 ]]
38
+ do
39
+ image_name=" $1 "
40
+ echo " ====> hyperledger/fabric-$image_name :$image_tag "
41
+ docker pull " hyperledger/fabric-$image_name :$image_tag "
42
+ docker tag " hyperledger/fabric-$image_name :$image_tag " " hyperledger/fabric-$image_name "
43
+ shift
50
44
done
51
45
}
52
46
53
- dockerCaPull () {
54
- local CA_TAG=$1
55
- echo " ==> FABRIC CA IMAGE"
56
- echo
57
- docker pull " hyperledger/fabric-ca:$CA_TAG "
58
- docker tag " hyperledger/fabric-ca:$CA_TAG " " hyperledger/fabric-ca"
59
- }
60
-
61
- samplesInstall () {
47
+ cloneSamplesRepo () {
62
48
# clone (if needed) hyperledger/fabric-samples and checkout corresponding
63
49
# version to the binaries and docker images to be downloaded
64
50
if [ -d first-network ]; then
@@ -90,7 +76,7 @@ download() {
90
76
fi
91
77
}
92
78
93
- binariesInstall () {
79
+ pullBinaries () {
94
80
echo " ===> Downloading version ${FABRIC_TAG} platform specific fabric binaries"
95
81
download " ${BINARY_FILE} " " https://github.com/hyperledger/fabric/releases/download/v${VERSION} /${BINARY_FILE} "
96
82
if [ $? -eq 22 ]; then
@@ -110,16 +96,30 @@ binariesInstall() {
110
96
fi
111
97
}
112
98
113
- dockerInstall () {
99
+ pullDockerImages () {
114
100
command -v docker >& /dev/null
115
101
NODOCKER=$?
116
102
if [ " ${NODOCKER} " == 0 ]; then
103
+ FABRIC_IMAGES=(peer orderer ccenv tools)
104
+ case " $VERSION " in
105
+ 1.* )
106
+ FABRIC_IMAGES+=(javaenv)
107
+ shift
108
+ ;;
109
+ 2.* )
110
+ FABRIC_IMAGES+=(nodeenv baseos javaenv)
111
+ shift
112
+ ;;
113
+ esac
114
+ echo " FABRIC_IMAGES:" " ${FABRIC_IMAGES[@]} "
117
115
echo " ===> Pulling fabric Images"
118
- dockerFabricPull " ${FABRIC_TAG} "
116
+ dockerPull " ${FABRIC_TAG} " " ${FABRIC_IMAGES[@] }"
119
117
echo " ===> Pulling fabric ca Image"
120
- dockerCaPull " ${CA_TAG} "
118
+ CA_IMAGE=(ca)
119
+ dockerPull " ${CA_TAG} " " ${CA_IMAGE[@]} "
121
120
echo " ===> Pulling thirdparty docker images"
122
- dockerThirdPartyImagesPull " ${THIRDPARTY_TAG} "
121
+ THIRDPARTY_IMAGES=(zookeeper kafka couchdb)
122
+ dockerPull " ${THIRDPARTY_TAG} " " ${THIRDPARTY_IMAGES[@]} "
123
123
echo
124
124
echo " ===> List out hyperledger docker images"
125
125
docker images | grep hyperledger
@@ -179,19 +179,19 @@ done
179
179
180
180
if [ " $SAMPLES " == " true" ]; then
181
181
echo
182
- echo " Installing hyperledger/fabric-samples repo"
182
+ echo " Clone hyperledger/fabric-samples repo"
183
183
echo
184
- samplesInstall
184
+ cloneSamplesRepo
185
185
fi
186
186
if [ " $BINARIES " == " true" ]; then
187
187
echo
188
- echo " Installing Hyperledger Fabric binaries"
188
+ echo " Pull Hyperledger Fabric binaries"
189
189
echo
190
- binariesInstall
190
+ pullBinaries
191
191
fi
192
192
if [ " $DOCKER " == " true" ]; then
193
193
echo
194
- echo " Installing Hyperledger Fabric docker images"
194
+ echo " Pull Hyperledger Fabric docker images"
195
195
echo
196
- dockerInstall
196
+ pullDockerImages
197
197
fi
0 commit comments