2021-06-02 07:45:40 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2021-08-31 18:08:37 +02:00
|
|
|
set -e
|
|
|
|
|
2021-09-21 16:57:52 +02:00
|
|
|
GOLANG_VERSION=1.17.1
|
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-09-21 16:57:52 +02:00
|
|
|
CHECKSUM="dab7d9c34361dc21ec237d584590d72500652e7c909bf082758fb63064fca0ef *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-09-21 16:57:52 +02:00
|
|
|
CHECKSUM="53b29236fa03ed862670a5e5e2ab2439a2dc288fe61544aa392062104ac0128c *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-09-21 16:57:52 +02:00
|
|
|
CHECKSUM="ed3e4dbc9b80353f6482c441d65b51808290e94ff1d15d56da5f4a7be7353758 *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
|