forked from cloudfoundry/python-buildpack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_go.sh
More file actions
executable file
·37 lines (28 loc) · 1.04 KB
/
Copy pathinstall_go.sh
File metadata and controls
executable file
·37 lines (28 loc) · 1.04 KB
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
#!/bin/bash
set -euo pipefail
GO_VERSION="1.12.4"
if [ $CF_STACK == "cflinuxfs3" ]; then
GO_SHA256="e68279204493307782c51105c3dd5254ab066d0b5d9aafa3ce3a2878ebbef53f"
else
echo " **ERROR** Unsupported stack"
echo " See https://docs.cloudfoundry.org/devguide/deploy-apps/stacks.html for more info"
exit 1
fi
export GoInstallDir="/tmp/go$GO_VERSION"
mkdir -p $GoInstallDir
if [ ! -f $GoInstallDir/go/bin/go ]; then
URL=https://buildpacks.cloudfoundry.org/dependencies/go/go${GO_VERSION}.linux-amd64-${CF_STACK}-${GO_SHA256:0:8}.tar.gz
echo "-----> Download go ${GO_VERSION}"
curl -s -L --retry 15 --retry-delay 2 $URL -o /tmp/go.tar.gz
DOWNLOAD_SHA256=$(shasum -a 256 /tmp/go.tar.gz | cut -d ' ' -f 1)
if [[ $DOWNLOAD_SHA256 != $GO_SHA256 ]]; then
echo " **ERROR** SHA256 mismatch: got $DOWNLOAD_SHA256 expected $GO_SHA256"
exit 1
fi
tar xzf /tmp/go.tar.gz -C $GoInstallDir
rm /tmp/go.tar.gz
fi
if [ ! -f $GoInstallDir/go/bin/go ]; then
echo " **ERROR** Could not download go"
exit 1
fi