Support colorful cmd

pull/45/head
Baohua Yang 2017-05-12 13:42:40 +08:00
parent 86b92d7bbd
commit 8a6aef897d
4 changed files with 39 additions and 9 deletions

View File

@ -1,11 +1,13 @@
#! /bin/bash
#!/usr/bin/env bash
source ./header.sh
ARCH=x86_64
BASE_VERSION=1.0.0-preview
PROJECT_VERSION=1.0.0-preview
IMG_VERSION=0.9.2
echo "Downloading images from DockerHub..."
echo_b "Downloading images from DockerHub..."
docker pull yeasy/hyperledger-fabric-base:$IMG_VERSION \
&& docker pull yeasy/hyperledger-fabric-peer:$IMG_VERSION \
@ -15,7 +17,7 @@ docker pull yeasy/hyperledger-fabric-base:$IMG_VERSION \
# Only useful for debugging
# docker pull yeasy/hyperledger-fabric
echo "Rename images with official tags..."
echo_b "Rename images with official tags..."
docker tag yeasy/hyperledger-fabric-peer:$IMG_VERSION hyperledger/fabric-peer \
&& docker tag yeasy/hyperledger-fabric-orderer:$IMG_VERSION hyperledger/fabric-orderer \
&& docker tag yeasy/hyperledger-fabric-ca:$IMG_VERSION hyperledger/fabric-ca \

View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
## DO NOT MODIFY THE FOLLOWING PART, UNLESS YOU KNOW WHAT IT MEANS ##
echo_r () {
[ $# -ne 1 ] && return 0
echo -e "\033[31m$1\033[0m"
}
echo_g () {
[ $# -ne 1 ] && return 0
echo -e "\033[32m$1\033[0m"
}
echo_y () {
[ $# -ne 1 ] && return 0
echo -e "\033[33m$1\033[0m"
}
echo_b () {
[ $# -ne 1 ] && return 0
echo -e "\033[34m$1\033[0m"
}

View File

@ -1,22 +1,29 @@
#! /bin/bash
#!/usr/bin/env bash
source ./header.sh
if [ xroot != x$(whoami) ]
then
echo "You must run as root (Hint: sudo su)"
echo_r "You must run as root (Hint: sudo su)"
exit
fi
apt-get update && apt-get install curl -y
echo "Install Docker..."
echo_b "Install Docker..."
wget -qO- https://get.docker.com/ | sh
sudo service docker stop
nohup sudo docker daemon --api-cors-header="*" -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock&
echo "Install Docker-Compose..."
echo_g "Docker Installation Done"
echo_b "Install Docker-Compose..."
curl -L https://github.com/docker/compose/releases/download/1.8.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
echo_g "Docker-Compose Installation Done"

View File

@ -1,4 +1,6 @@
#! /bin/bash
#!/usr/bin/env bash
source ./header.sh
COMPOSE_FILE=${1:-"docker-compose.yml"}
@ -6,6 +8,6 @@ bash ./setup_Docker.sh
bash ./download_images.sh
echo "Start up with ${COMPOSE_FILE}"
echo_b "Start up with ${COMPOSE_FILE}"
docker-compose -f ${COMPOSE_FILE} up -d