-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy path1_install_core.sh
executable file
·113 lines (98 loc) · 3.34 KB
/
1_install_core.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
#!/bin/bash
# While Docker 1.9 is not supported in an official RPM it can be built
# using the GitHub releases for trying out the upcoming features
# Allow toggling components to install and update based off flags
updateconsul=1
updatedocker=1
updatedockermachine=1
updatedockercompose=1
updatedockerswarm=1
consulversion="0.5.2"
dockerversion="1.9.0"
dockermachineversion="v0.5.0"
dockercomposeversion="1.5.1"
dockerswarmversion="1.0.0"
echo ""
echo "Updating Consul($updateconsul)"
echo "Updating Docker($updatedocker)"
echo "Updating Docker Machine($updatedockermachine)"
echo "Updating Docker Compose($updatedockercompose)"
echo "Updating Docker Swarm($updatedockerswarm)"
echo ""
echo "Starting Install"
echo ""
if [ $updateconsul -eq 1 ]; then
echo ""
echo "Installing Consul version: $consulversion"
echo ""
pushd /tmp >> /dev/null
rm -f /tmp/consul.zip
rm -f /tmp/consul
wget https://releases.hashicorp.com/consul/${consulversion}/consul_${consulversion}_linux_amd64.zip -O /tmp/consul.zip
unzip consul.zip
cp ./consul /usr/local/bin
cp ./consul /usr/bin
rm -f /tmp/consul.zip
rm -f /tmp/consul
popd >> /dev/null
echo ""
echo "Done Installing Consul version: $consulversion"
echo ""
fi
# Docker 1.9 is not shipped in an rpm yet:
if [ $updatedocker -eq 1 ]; then
echo ""
echo "Installing Docker version: $dockerversion"
echo ""
# To install, run the following command as root:
curl -sSL -O https://get.docker.com/builds/Linux/x86_64/docker-${dockerversion} && chmod +x docker-${dockerversion} && mv docker-${dockerversion} /usr/local/bin/docker
echo ""
echo "Done Installing Docker version: $dockerversion"
echo ""
fi
# Now install Docker-Machine: https://github.com/docker/machine/releases/
if [ $updatedockermachine -eq 1 ]; then
echo ""
echo "Installing Docker Machine version: $dockermachineversion"
echo ""
curl -L https://github.com/docker/machine/releases/download/${dockermachineversion}/docker-machine_linux-amd64.zip >machine.zip && \
unzip machine.zip && \
rm machine.zip && \
mv -f docker-machine* /usr/local/bin
echo ""
echo "Done Installing Docker Machine version: $updatedockermachine"
echo ""
fi
# Now install Docker-Compose: https://github.com/docker/compose/releases/
if [ $updatedockercompose -eq 1 ]; then
echo ""
echo "Installing Docker Compose version: $dockercomposeversion"
echo ""
curl -L https://github.com/docker/compose/releases/download/${dockercomposeversion}/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
echo ""
echo "Done Installing Docker Compose version: $updatedockercompose"
echo ""
fi
# Now install Docker-Swarm: https://github.com/docker/swarm/releases
if [ $updatedockerswarm -eq 1 ]; then
echo ""
echo "Installing Docker Swarm version: $dockerswarmversion"
echo ""
pushd /opt >> /dev/null
if [ ! -e $goworkspacepath ]; then
mkdir $goworkspacepath >> /dev/null
chmod 777 $goworkspacepath >> /dev/null
fi
export GOPATH=$goworkspacepath
echo " - Using GOPATH($GOPATH) set this in ./common.sh if you want to override"
go get github.com/docker/swarm
chmod 777 $GOPATH/bin/swarm
rm -f /usr/local/bin/swarm >> /dev/null
ln -s $GOPATH/bin/swarm /usr/local/bin/swarm
pushd >> /dev/null
echo ""
echo "Done Installing Docker Swarm version: $updatedockerswarm"
echo ""
fi
exit 0