-
Notifications
You must be signed in to change notification settings - Fork 16
/
install_cli.sh
executable file
·109 lines (83 loc) · 3.03 KB
/
install_cli.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
# Checking if bx is installed
grn=$'\e[1;32m'
end=$'\e[0m'
BX_PATH=$(command -v bx)
if [[ $? -ne 0 ]]; then
printf "\n\n${grn}Installing Bluemix CLI (bx)...${end}\n"
LATEST=$(curl -s https://clis.ng.bluemix.net/info | grep latestVersion | cut -d: -f2 | sed -e 's/"//g' -e 's/,//')
if [[ $OSTYPE =~ .*darwin.* ]]; then
curl -o Bluemix_CLI.pkg "http://public.dhe.ibm.com/cloud/bluemix/cli/bluemix-cli/Bluemix_CLI_${LATEST}.pkg"
sudo installer -pkg Bluemix_CLI.pkg -target /
rm Bluemix_CLI.pkg
elif [[ $OSTYPE =~ .*linux.* ]]; then
curl -o Bluemix_CLI.tar.gz "http://public.dhe.ibm.com/cloud/bluemix/cli/bluemix-cli/Bluemix_CLI_${LATEST}_amd64.tar.gz"
tar zxvf Bluemix_CLI.tar.gz
Bluemix_CLI/install_bluemix_cli
rm -f /tmp/Bluemix_CLI.tar.gz
rm -rf /tmp/Bluemix_CLI
fi
fi
# Check if bx cs is installed
bx cs &> /dev/null
if [[ $? -ne 0 ]]; then
printf "\n\n${grn}Installing Bluemix Container Service (bx cs) plugin...${end}\n"
bx plugin install container-service -r Bluemix
fi
# Check if bx cr is installed
bx cr &> /dev/null
if [[ $? -ne 0 ]]; then
printf "\n\n${grn}Installing Bluemix Container Registry Service (bx cr) plugin...${end}\n"
bx plugin install container-registry -r Bluemix
fi
# Checking if kubectl is installed
KUBE_PATH=$(command -v kubectl)
if [[ $? -ne 0 ]]; then
printf "\n\n${grn}Installing Kubernetes CLI (kubectl)...${end}\n"
if [[ $OSTYPE =~ .*darwin.* ]]; then
# OS X
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl
elif [[ $OSTYPE =~ .*linux.* ]]; then
# Linux
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
fi
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
fi
# Checking if helm is installed
KUBE_PATH=$(command -v helm)
if [[ $? -ne 0 ]]; then
printf "\n\n${grn}Installing Helm CLI (helm)...${end}\n"
curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > get_helm.sh
chmod 700 get_helm.sh
./get_helm.sh -v v2.4.2
rm get_helm.sh
fi
# Installing jq
JQ_PATH=$(command -v jq)
if [[ $? -ne 0 ]]; then
printf "\n\n${grn}Installing jq${end}\n"
if [[ $OSTYPE =~ .*darwin.* ]]; then
# OS X
curl -Lo jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-osx-amd64
elif [[ $OSTYPE =~ .*linux.* ]]; then
# Linux
curl -o jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64
fi
chmod +x ./jq
sudo mv ./jq /usr/local/bin/jq
fi
# Installing yaml
YAML_PATH=$(command -v yaml)
if [[ $? -ne 0 ]]; then
printf "\n\n${grn}Installing YAML${end}\n"
if [[ $OSTYPE =~ .*darwin.* ]]; then
# OS X
curl -LO https://github.com/mikefarah/yaml/releases/download/1.10/yaml_darwin_amd64
mv yaml_darwin_amd64 yaml
elif [[ $OSTYPE =~ .*linux.* ]]; then
# Linux
curl -o yaml https://github.com/mikefarah/yaml/releases/download/1.8/yaml_linux_amd64
fi
chmod +x ./yaml
sudo mv ./yaml /usr/local/bin/yaml
fi