Fix golang installation script for arm64 platform

pull/11453/head
Ilya Zuyev 2021-05-18 22:00:57 -07:00
parent 4f345f2b8f
commit 6da92d44f6
1 changed files with 16 additions and 2 deletions

View File

@ -25,7 +25,21 @@ fi
VERSION_TO_INSTALL=${1}
INSTALL_PATH=${2}
ARCH=${ARCH:=amd64}
function current_arch() {
case $(arch) in
"x86_64")
echo "amd64"
;;
"aarch64")
echo "arm64"
;;
*)
echo "amd64"
;;
esac
}
ARCH=${ARCH:=$(current_arch)}
# installs or updates golang if right version doesn't exists
function check_and_install_golang() {
@ -62,7 +76,7 @@ function install_golang() {
# using sudo because previously installed versions might have been installed by a different user.
# as it was the case on jenkins VM.
sudo curl -qL -O "https://storage.googleapis.com/golang/go${1}.${INSTALLOS}-${ARCH}.tar.gz" &&
sudo tar -xzf go${1}.${INSTALLOS}-amd64.tar.gz &&
sudo tar -xzf go${1}.${INSTALLOS}-${ARCH}.tar.gz &&
sudo rm -rf "${2}/go" &&
sudo mv go "${2}/" && sudo chown -R $(whoami): ${2}/go
popd >/dev/null