-
Notifications
You must be signed in to change notification settings - Fork 3
/
google-cloud-sdk.sh
executable file
·43 lines (33 loc) · 1.43 KB
/
google-cloud-sdk.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
#!/bin/sh
DOTFILES_BOOTSTRAP=false . ./bootstrap.sh
package="google-cloud-sdk"
if ! command_is_executable gcloud; then
info "Installing $package..."
if [ -x "$(command -v apt-get)" ]; then
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" \
| sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
apt-get install apt-transport-https ca-certificates
install_packages_if_necessary curl
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg \
| sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update
sudo apt-get install "$package" || die "Installing $package failed"
elif [ -x "$(command -v brew)" ]; then
brew cask install "$package" || die "Installing $package failed"
elif [ -x "$(command -v yum)" ]; then
sudo tee -a /etc/yum.repos.d/google-cloud-sdk.repo << EOM
[google-cloud-sdk]
name=Google Cloud SDK
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOM
sudo yum install "$package"
else
curl -fsSL https://sdk.cloud.google.com \
| bash -- -s --disable-prompts --install-dir="$HOME/.local/"
fi
fi