-
Notifications
You must be signed in to change notification settings - Fork 4
/
gcp_cli_setup
60 lines (48 loc) · 1.09 KB
/
gcp_cli_setup
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
#!/bin/bash
# Install Google Cloud CLI
# Constants ########
readonly WAITLONG=3
readonly WAITSMALL=1
####################
# The installation function
install()
{
sleep $WAITLONG
pkg install -y $1
}
# Main function
main(){
install_gcloud_cli
}
# Get Device 32bit/64bit
device_64_bit(){
cpu=`uname -m`
if [[ $cpu == *"64"* ]]
then
return 0
elif [[ $cpu == *"armv7"* ]]
then
return 1
else
return 0
fi
}
# Download and Install Google Cloud CLI
install_gcloud_cli(){
device_64_bit
bit64=$?
if [ $bit64 -eq 0 ]
then
curl -Lo google-cloud.tar.gz https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-453.0.0-linux-x86_64.tar.gz
else
curl -Lo google-cloud.tar.gz https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-453.0.0-linux-x86.tar.gz
fi
# Extract .tar.gz file
tar -xzf google-cloud.tar.gz
# Run installation script
./google-cloud-sdk/install.sh
# Clean up
rm google-cloud.tar.gz
}
# Main App
main