Created
July 31, 2021 15:10
-
-
Save panekj/37c0363a1dbc2156af1845543bb66488 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
export PS_VERSION=$1 | |
export PS_PACKAGE=powershell-${PS_VERSION}-linux-alpine-x64.tar.gz | |
export PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE} | |
export PS_INSTALL_VERSION=$PS_VERSION | |
cd /tmp/ | |
wget ${PS_PACKAGE_URL} | |
export PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION | |
mkdir -p ${PS_INSTALL_FOLDER} | |
tar zxf /tmp/${PS_PACKAGE} -C ${PS_INSTALL_FOLDER} -v | |
export PS_INSTALL_VERSION=$PS_VERSION | |
export PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION | |
export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false | |
export LC_ALL=en_GB.UTF-8 | |
export LANG=en_GB.UTF-8 | |
export PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache | |
apk add --no-cache ca-certificates less ncurses-terminfo-base krb5-libs libgcc libintl libssl1.1 libstdc++ tzdata userspace-rcu zlib icu-libs \ | |
&& apk -X http://dl-cdn.alpinelinux.org/alpine/edge/main add --no-cache lttng-ust \ | |
&& ln -s -b ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh \ | |
&& ln -s -b ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh-preview \ | |
&& chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \ | |
&& pwsh -NoLogo -NoProfile -Command " \ | |
\$ErrorActionPreference = 'Stop' ; \ | |
\$ProgressPreference = 'SilentlyContinue' ; \ | |
while(!(Test-Path -Path \$env:PSModuleAnalysisCachePath)) { \ | |
Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; \ | |
Start-Sleep -Seconds 6 ; \ | |
}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment