Skip to content

Instantly share code, notes, and snippets.

@alexrios
Last active December 28, 2018 19:31
Show Gist options
  • Save alexrios/faf32cba04e5bc1face699127f458e2e to your computer and use it in GitHub Desktop.
Save alexrios/faf32cba04e5bc1face699127f458e2e to your computer and use it in GitHub Desktop.
./gcloud-install <version> (default is 228.0.0)
#!/bin/bash
SPECIFIED_VERSION=$1
DEFAULT_VERSION=228.0.0
GCLOUD_VERSION=${SPECIFIED_VERSION:-$DEFAULT_VERSION}
echo "Installing GCLOUD version ${GCLOUD_VERSION}"
UPSTREAM=https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${GCLOUD_VERSION}-linux-x86_64.tar.gz
GCLOUD_PATH=~/gcloud
DOWNLOAD_PATH=/tmp
mkdir -p $GCLOUD_PATH/google-cloud-sdk \
&& wget -q --show-progress $UPSTREAM -O $DOWNLOAD_PATH/google-cloud-sdk.tar.gz \
&& tar -xzvf $DOWNLOAD_PATH/google-cloud-sdk.tar.gz \
&& mv google-cloud-sdk $GCLOUD_PATH \
&& $GCLOUD_PATH/google-cloud-sdk/install.sh \
&& $GCLOUD_PATH/google-cloud-sdk/bin/gcloud init
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment