3
3
sudo apt-get update -y
4
4
sudo apt-get install unzip curl vim jq -y
5
5
# make an archive folder to move old binaries into
6
- sudo mkdir /tmp/archive/
6
+ if [ ! -d /tmp/archive ]; then
7
+ sudo mkdir /tmp/archive/
8
+ fi
7
9
8
10
# Install Docker Community Edition
9
11
echo " Docker Install Beginning..."
@@ -27,8 +29,15 @@ echo "Nomad Install Beginning..."
27
29
NOMAD_VERSION=0.9.5
28
30
cd /tmp/
29
31
sudo curl -sSL https://releases.hashicorp.com/nomad/${NOMAD_VERSION} /nomad_${NOMAD_VERSION} _linux_amd64.zip -o nomad.zip
30
- sudo unzip nomad.zip
31
- sudo install nomad /usr/bin/nomad
32
+ if [ ! -d nomad ]; then
33
+ sudo unzip nomad.zip
34
+ fi
35
+ if [ ! -f /usr/bin/nomad ]; then
36
+ sudo install nomad /usr/bin/nomad
37
+ fi
38
+ if [ -f /tmp/archive/nomad ]; then
39
+ sudo rm /tmp/archive/nomad
40
+ fi
32
41
sudo mv /tmp/nomad /tmp/archive/nomad
33
42
sudo mkdir -p /etc/nomad.d
34
43
sudo chmod a+w /etc/nomad.d
@@ -40,8 +49,15 @@ echo "Consul Install Beginning..."
40
49
CONSUL_VERSION=$( curl -s https://checkpoint-api.hashicorp.com/v1/check/consul | jq -r " .current_version" )
41
50
# CONSUL_VERSION=1.4.0
42
51
sudo curl -sSL https://releases.hashicorp.com/consul/${CONSUL_VERSION} /consul_${CONSUL_VERSION} _linux_amd64.zip > consul.zip
43
- sudo unzip /tmp/consul.zip
44
- sudo install consul /usr/bin/consul
52
+ if [ ! -d consul ]; then
53
+ sudo unzip /tmp/consul.zip
54
+ fi
55
+ if [ ! -f /usr/bin/consul ]; then
56
+ sudo install consul /usr/bin/consul
57
+ fi
58
+ if [ -f /tmp/archive/consul ]; then
59
+ sudo rm /tmp/archive/consul
60
+ fi
45
61
sudo mv /tmp/consul /tmp/archive/consul
46
62
sudo mkdir -p /etc/consul.d
47
63
sudo chmod a+w /etc/consul.d
@@ -50,7 +66,15 @@ sudo cp /vagrant/consul-config/consul-server-east.hcl /etc/consul.d/
50
66
for bin in cfssl cfssl-certinfo cfssljson
51
67
do
52
68
echo " $bin Install Beginning..."
53
- curl -sSL https://pkg.cfssl.org/R1.2/${bin} _linux-amd64 > /tmp/${bin}
54
- sudo install /tmp/${bin} /usr/local/bin/${bin}
69
+ if [ ! -f /tmp/${bin} ]; then
70
+ curl -sSL https://pkg.cfssl.org/R1.2/${bin} _linux-amd64 > /tmp/${bin}
71
+ fi
72
+ if [ ! -f /usr/local/bin/${bin} ]; then
73
+ sudo install /tmp/${bin} /usr/local/bin/${bin}
74
+ fi
55
75
done
56
- nomad -autocomplete-install
76
+ cat /root/.bashrc | grep " complete -C /usr/bin/nomad nomad"
77
+ retval=$?
78
+ if [ $retval -eq 1 ]; then
79
+ nomad -autocomplete-install
80
+ fi
0 commit comments