Skip to content

Commit

Permalink
FAB-11335 Fix bootstrap.sh args handling
Browse files Browse the repository at this point in the history
This change fixes the parsing of the optional arguments and displays a more
accurate usage message:

$ ./scripts/bootstrap.sh -h
Usage: bootstrap.sh [version [ca_version [thirdparty_version]]] [options]

options:
-h : this help
-d : bypass docker image download
-s : bypass fabric-samples repo clone
-b : bypass download of platform-specific binaries

e.g. bootstrap.sh 1.2.0 -s
would download docker images and binaries for version 1.2.0

$ ./scripts/bootstrap.sh 1.2.0 -b

Installing hyperledger/fabric-samples repo

===> Checking out v1.2.0 branch of hyperledger/fabric-samples
HEAD is now at ed81d7b... [FAB-10811] fabric-ca sample is broken on v1.2

Installing Hyperledger Fabric docker images

===> Pulling fabric Images
==> FABRIC IMAGE: peer
...

FAB-11335 #done

Change-Id: I94facb853e7fdbf50e0a6a9eb76358cfee010e3c
Signed-off-by: Arnaud J Le Hors <[email protected]>
  • Loading branch information
lehors authored and mastersingh24 committed Aug 3, 2018
1 parent f10cd75 commit 63e90ec
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ export ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/wi
export MARCH=$(uname -m)

printHelp() {
echo "Usage: bootstrap.sh [<version>] [<ca_version>] [<thirdparty_version>][-d -s -b]"
echo "Usage: bootstrap.sh [version [ca_version [thirdparty_version]]] [options]"
echo
echo "-d - bypass docker image download"
echo "-s - bypass fabric-samples repo clone"
echo "-b - bypass download of platform-specific binaries"
echo "options:"
echo "-h : this help"
echo "-d : bypass docker image download"
echo "-s : bypass fabric-samples repo clone"
echo "-b : bypass download of platform-specific binaries"
echo
echo "e.g. bootstrap.sh 1.2.0 -s"
echo "would download docker images and binaries for version 1.2.0"
Expand Down Expand Up @@ -174,11 +176,11 @@ BINARIES=true

# Parse commandline args pull out
# version and/or ca-version strings first
if [ ! -z $1 ]; then
if [ ! -z $1 -a ${1:0:1} != "-" ]; then
VERSION=$1;shift
if [ ! -z $1 ]; then
if [ ! -z $1 -a ${1:0:1} != "-" ]; then
CA_VERSION=$1;shift
if [ ! -z $1 ]; then
if [ ! -z $1 -a ${1:0:1} != "-" ]; then
THIRDPARTY_IMAGE_VERSION=$1;shift
fi
fi
Expand Down

0 comments on commit 63e90ec

Please sign in to comment.