2021-06-02 07:45:40 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2021-08-31 18:08:37 +02:00
|
|
|
set -e
|
|
|
|
|
|
|
|
GOLANG_VERSION=1.17
|
2021-06-02 07:45:40 +02:00
|
|
|
|
|
|
|
if [[ -z $1 ]]; then
|
2021-08-31 18:08:37 +02:00
|
|
|
echo "architecture required: amd64, arm64, or arm" 1>&2
|
2021-06-02 07:45:40 +02:00
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
set -eux;
|
|
|
|
if [[ $1 == "amd64" ]]; then
|
|
|
|
URL="https://golang.org/dl/go${GOLANG_VERSION}.linux-$1.tar.gz"
|
2021-08-31 18:08:37 +02:00
|
|
|
CHECKSUM="6bf89fc4f5ad763871cf7eac80a2d594492de7a818303283f1366a7f6a30372d *go.tgz"
|
2021-06-02 07:45:40 +02:00
|
|
|
elif [[ $1 == "arm64" ]]; then
|
|
|
|
URL="https://golang.org/dl/go${GOLANG_VERSION}.linux-$1.tar.gz"
|
2021-08-31 18:08:37 +02:00
|
|
|
CHECKSUM="01a9af009ada22122d3fcb9816049c1d21842524b38ef5d5a0e2ee4b26d7c3e7 *go.tgz"
|
2021-06-02 07:45:40 +02:00
|
|
|
elif [[ $1 == "arm" ]]; then
|
|
|
|
URL="https://golang.org/dl/go${GOLANG_VERSION}.linux-armv6l.tar.gz"
|
2021-08-31 18:08:37 +02:00
|
|
|
CHECKSUM="ae89d33f4e4acc222bdb04331933d5ece4ae71039812f6ccd7493cb3e8ddfb4e *go.tgz"
|
2021-06-02 07:45:40 +02:00
|
|
|
else
|
2021-08-31 18:08:37 +02:00
|
|
|
echo "unsupported architecture" 1>&2
|
2021-06-02 07:45:40 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
wget -O go.tgz $URL
|
|
|
|
echo $CHECKSUM | sha256sum -c -
|
2021-08-05 11:09:26 +02:00
|
|
|
rm -rf /usr/local/go
|
2021-06-02 07:45:40 +02:00
|
|
|
tar -C /usr/local -xzf go.tgz
|
|
|
|
rm go.tgz
|
2021-08-05 11:09:26 +02:00
|
|
|
/usr/local/go/bin/go version
|
2021-06-02 07:45:40 +02:00
|
|
|
fi
|