add arm64/armhf for 18.04, replace git{,-lfs} (#51)

This commit is contained in:
Ryan
2022-03-05 04:22:34 +01:00
committed by GitHub
parent 664778dd40
commit 343ae52a8b
11 changed files with 255 additions and 91 deletions
+11 -8
View File
@@ -1,6 +1,6 @@
#!/bin/bash
# shellcheck disable=SC1091,SC2174
# shellcheck disable=SC1091
. /etc/environment
set -Eeuxo pipefail
@@ -9,20 +9,23 @@ printf "\n\t🐋 Installing Go(lang) 🐋\t\n"
JSON=$(wget -qO- "$(jq -r '.toolcache[] | select(.name == "go") | .url' "/imagegeneration/toolset.json")" | jq --compact-output)
go_arch() {
case "$(uname -m)" in
'x86_64') echo 'amd64' ;;
'aarch64') echo 'arm64' ;;
esac
}
for V in $(jq -r '.toolcache[] | select(.name == "go") | .versions[]' "/imagegeneration/toolset.json"); do
printf "\n\t🐋 Installing GO=%s 🐋\t\n" "${V}"
VER=$(echo "${JSON}" | jq "[.[] | select(.version|test(\"^${V}\"))][0].version" -r)
GOPATH="$AGENT_TOOLSDIRECTORY/go/${VER}/x64"
# shellcheck disable=SC2174
mkdir -v -m 0777 -p "$GOPATH"
ARCH=$(uname -m)
if [ "$ARCH" = x86_64 ]; then ARCH=amd64; fi
if [ "$ARCH" = aarch64 ]; then ARCH=arm64; fi
wget -qO- "https://golang.org/dl/go${VER}.linux-$ARCH.tar.gz" | tar -zxf - --strip-components=1 -C "$GOPATH"
wget -qO- "https://golang.org/dl/go${VER}.linux-$(go_arch).tar.gz" | tar -zxf - --strip-components=1 -C "$GOPATH"
ENVVAR="${V//\./_}"
echo "${ENVVAR}=${GOPATH}" >>/etc/environment
# ENVVAR="${V//\./_}"
# echo "${ENVVAR}=${GOPATH}" >>/etc/environment
printf "\n\t🐋 Installed GO 🐋\t\n"
"$GOPATH/bin/go" version