forked from Flank/gcloud_cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
executable file
·48 lines (36 loc) · 1.15 KB
/
update.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
#!/bin/bash
set -euxo pipefail
# get latest version number from https://cloud.google.com/sdk/docs/downloads-versioned-archives
# or view version number on the website: https://cloud.google.com/sdk/docs/quickstart-linux
#
# https://storage.cloud.google.com/cloud-sdk-release
#
# gsutil ls -l gs://cloud-sdk-release/for_packagers/linux > list.txt
VERSION=$1
SDK_TESTS=google-cloud-sdk-tests_$VERSION.orig.tar.gz
SDK=google-cloud-sdk-$VERSION-linux-x86_64.tar.gz
SDK_TESTS_GS_PATH=gs://cloud-sdk-release/for_packagers/linux/$SDK_TESTS
STATUS=$(gsutil -q stat $SDK_TESTS_GS_PATH || echo 1)
if [[ $STATUS == 0 ]]; then
if [ ! -f "$SDK_TESTS" ]; then
gsutil cp $SDK_TESTS_GS_PATH .
else
echo "$SDK_TESTS exists"
fi
else
echo "File does not exist"
fi
if [ ! -f "$SDK" ]; then
curl https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/$SDK --output $SDK
else
echo "$SDK exists"
fi
echo "Updating google-cloud-sdk"
rm -rf google-cloud-sdk
if test -f "$SDK_TESTS"; then
tar -xzf $SDK_TESTS
fi
tar -xzf $SDK
# Over GitHub 100MB file limit
rm google-cloud-sdk/bin/anthoscli
gsutil ls -l gs://cloud-sdk-release/for_packagers/linux > list.txt