-
Notifications
You must be signed in to change notification settings - Fork 1
/
prepare_fabric.sh
executable file
·66 lines (52 loc) · 1.64 KB
/
prepare_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
#!/bin/bash
set +e
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
# install make
apt-get --assume-yes install make
# install gcc
apt-get --assume-yes install gcc
# install go
snap install go --classic
# install docker
snap install docker
if [ ! -d "/root/go/" ]; then
mkdir -p /root/go
fi
if [ ! -d "/root/gopath/" ]; then
mkdir -p /root/gopath
fi
if [ ! -d "/root/testnet/" ]; then
mkdir -p /root/testnet
fi
echo "export GOROOT=/root/go" >> /etc/profile
echo "export GOPATH=/root/gopath" >> /etc/profile
echo "export PATH=$PATH:/root/gopath/bin" >> /etc/profile
source /etc/profile
# install hyperledger fabric
if [ ! -d "/root/src/github.com/hyperledger/" ]; then
mkdir -p $GOPATH/src/github.com/hyperledger
fi
cd $GOPATH/src/github.com/hyperledger
if [ ! -d "fabric" ]; then
git clone -b release-1.3 https://github.com/hyperledger/fabric
fi
cd $GOPATH/src/github.com/hyperledger/fabric
if [ ! -f "./.build/bin/peer" ]; then
make peer
fi
if [ ! -f "./.build/bin/configtxgen" ]; then
make configtxgen
fi
if [ ! -f "./.build/bin/cryptogen" ]; then
make cryptogen
fi
if [ ! -f "./.build/bin/orderer" ]; then
make orderer
fi
echo "export FABRIC_HOME=$GOPATH/src/github.com/hyperledger/fabric" >> /etc/profile
echo "export PATH=$PATH:$GOPATH/src/github.com/hyperledger/fabric/.build/bin" >> /etc/profile
source /etc/profile
cp $FABRIC_HOME/sampleconfig/core.yaml /root/testnet/core.yaml
cp $FABRIC_HOME/sampleconfig/orderer.yaml /root/testnet/orderer.yaml
echo "export FABRIC_CFG_PATH=/root/testnet" >> /etc/profile
source /etc/profile