Make arm64 compatible

This commit is contained in:
Erik Sundell
2021-08-17 03:11:56 +02:00
parent ab5d728303
commit 447ca83cfa
5 changed files with 66 additions and 18 deletions
+5 -2
View File
@@ -90,10 +90,13 @@ printf "\n\t🐋 Installed moby-buildx 🐋\t\n"
docker buildx version
printf "\n\t🐋 Installing Node.JS 🐋\t\n"
ARCH=$(uname -m)
if [ "$ARCH" = x86_64 ]; then ARCH=x64; fi
if [ "$ARCH" = aarch64 ]; then ARCH=arm64; fi
VER=$(curl https://nodejs.org/download/release/index.json | jq "[.[] | select(.version|test(\"^v${NODE_VERSION}\"))][0].version" -r)
NODEPATH="$AGENT_TOOLSDIRECTORY/node/${VER:1}/x64"
NODEPATH="$AGENT_TOOLSDIRECTORY/node/${VER:1}/$ARCH"
mkdir -v -m 0777 -p "$NODEPATH"
curl -SsL "https://nodejs.org/download/release/latest-v${NODE_VERSION}.x/node-$VER-linux-x64.tar.xz" | tar -Jxf - --strip-components=1 -C "$NODEPATH"
curl -SsL "https://nodejs.org/download/release/latest-v${NODE_VERSION}.x/node-$VER-linux-$ARCH.tar.xz" | tar -Jxf - --strip-components=1 -C "$NODEPATH"
sed "s|^PATH=|PATH=$NODEPATH/bin:|mg" -i /etc/environment
export PATH="$NODEPATH/bin:$PATH"
+4 -1
View File
@@ -21,7 +21,10 @@ for V in $(jq -r '.toolcache[] | select(.name == "go") | .versions[]' "/imagegen
GOPATH="$AGENT_TOOLSDIRECTORY/go/${VER}/x64"
mkdir -v -m 0777 -p "$GOPATH"
wget -qO- "https://golang.org/dl/go${VER}.linux-amd64.tar.gz" | tar -zxf - --strip-components=1 -C "$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"
ENVVAR="${V//\./_}"
echo "${ENVVAR}=${GOPATH}" >>/etc/environment
+4 -1
View File
@@ -23,7 +23,10 @@ for V in "${versions[@]}"; do
# disable warning about 'mkdir -m -p'
# shellcheck disable=SC2174
mkdir -v -m 0777 -p "$NODEPATH"
wget -qO- "https://nodejs.org/download/release/latest-v${V}.x/node-$VER-linux-x64.tar.xz" | tar -Jxf - --strip-components=1 -C "$NODEPATH"
ARCH=$(uname -m)
if [ "$ARCH" = x86_64 ]; then ARCH=x64; fi
if [ "$ARCH" = aarch64 ]; then ARCH=arm64; fi
wget -qO- "https://nodejs.org/download/release/latest-v${V}.x/node-$VER-linux-$ARCH.tar.xz" | tar -Jxf - --strip-components=1 -C "$NODEPATH"
ENVVAR="${V//\./_}"
echo "${ENVVAR}=${NODEPATH}" >>/etc/environment
+22 -10
View File
@@ -3,8 +3,26 @@
set -Eeuxo pipefail
printf "\n\t🐋 Installing PowerShell 🐋\t\n"
sudo apt-get -yq update
sudo apt-get -yq install powershell
# While an linux/amd64 platform installation can use apt-get, the linux/arm64
# platform installation can't as described here:
# https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-7.1#support-for-arm-processors
#
# Due to that, we rely on the binary installation method for both platforms, as
# described here:
# https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-7.1#linux
#
ARCH=$(uname -m)
if [ "$ARCH" = x86_64 ]; then ARCH=x64; fi
if [ "$ARCH" = aarch64 ]; then ARCH=arm64; fi
VER=$(curl --silent "https://api.github.com/repos/PowerShell/PowerShell/releases/latest" | jq -r .tag_name)
curl -L -o /tmp/powershell.tar.gz "https://github.com/PowerShell/PowerShell/releases/download/$VER/powershell-${VER:1}-linux-$ARCH.tar.gz"
sudo mkdir -p "/opt/microsoft/powershell/${VER:1:1}"
sudo tar zxf /tmp/powershell.tar.gz -C "/opt/microsoft/powershell/${VER:1:1}"
sudo chmod +x "/opt/microsoft/powershell/${VER:1:1}/pwsh"
sudo ln -s "/opt/microsoft/powershell/${VER:1:1}/pwsh" /usr/bin/pwsh
rm /tmp/powershell.tar.gz
printf "\n\t🐋 Installed PWSH 🐋\t\n"
pwsh -v
@@ -13,12 +31,6 @@ printf "\n\t🐋 Installing PowerShell modules 🐋\t\n"
modules=("MarkdownPS" "Pester" "PSScriptAnalyzer")
for mod in "${modules[@]}"; do
printf "\n\t🐋 Installing %s 🐋\t\n" "${mod}"
pwsh -nol -nop -c "Install-Module -Name ${mod} -Scope AllUsers -SkipPublisherCheck -Force"
printf "\n\t🐋 Installing %s 🐋\t\n" "${mod}"
pwsh -nol -nop -c "Install-Module -Name ${mod} -Scope AllUsers -SkipPublisherCheck -Force"
done
printf "\n\t🐋 Cleaning image 🐋\t\n"
apt-get clean
rm -rf /var/cache/* /var/log/* /var/lib/apt/lists/* /tmp/* || echo 'Failed to delete directories'
printf "\n\t🐋 Cleaned up image 🐋\t\n"