Skip to content

Instantly share code, notes, and snippets.

@glickbot
Created June 4, 2019 20:49
Show Gist options
  • Save glickbot/561ca0c92dfd9b8225cdcd4db71e1b47 to your computer and use it in GitHub Desktop.
Save glickbot/561ca0c92dfd9b8225cdcd4db71e1b47 to your computer and use it in GitHub Desktop.
Simple unattended gcloud installer
#!/bin/bash
set -e
pushd $HOME > /dev/null
if ! which gcloud > /dev/null; then
arch="x86"
os="linux"
if uname -a | grep -i 'x86_64' > /dev/null; then
arch="x86_64"
fi
if uname -a | grep -i 'darwin' > /dev/null; then
os="darwin"
fi
curl -s $(curl https://cloud.google.com/sdk/docs/downloads-versioned-archives -s -o -|grep -Eo 'https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-([0-9\-\.]*)-'$os'-'$arch'.tar.gz')|tar -xz
./google-cloud-sdk/install.sh --usage-reporting false -q --command-completion true --path-update true
fi
popd > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment