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
·39 lines (30 loc) · 1.16 KB
/
Copy pathinstall_go.sh
File metadata and controls
executable file
·39 lines (30 loc) · 1.16 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
38
39
#!/bin/bash
set -euo pipefail
GO_VERSION="1.11.5"
if [ $CF_STACK == "cflinuxfs2" ]; then
GO_SHA256="51cab63f3de5e2f75a9036801712e4d7ae9bf226f0b61abce8d784e698148d3b"
elif [ $CF_STACK == "cflinuxfs3" ]; then
GO_SHA256="ee770df4e1863ee8e07574cb48e0245b61bec8f118faf6ec3742ea89eb20db28"
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