Make arm64 compatible
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user