mirror of
https://github.com/PowerShell/PowerShell.git
synced 2024-11-26 19:34:22 +08:00
Adding ability to install previews side-by-side with production releases (#7194)
-preview switch: - installs pwsh-preview packages when a package manager is being used. - uses link name pwsh-preview when tar ball install is being done - results in preview release being available for calling manually, but does not become systemwide version Issue #7177
This commit is contained in:
parent
1d549497cf
commit
68ab1e09a6
@ -24,7 +24,7 @@
|
||||
* -includeide - installs vscode and vscode powershell extension (only relevant to machines with desktop environment)
|
||||
* -interactivetesting - do a quick launch test of vscode - only relevant when used with -includeide
|
||||
* -skip-sudo-check - use sudo without verifying it's availability (hard to accurately do on some distros)
|
||||
* -allowprerelease - includes prereleases of powershell core when selection allows this. Repository based installs take the latest on the repo url regardless of this switch.
|
||||
* -preview - installs preview of powershell core side-by-side with any existing production releases.
|
||||
|
||||
## Usage
|
||||
|
||||
|
@ -24,6 +24,7 @@ gitreposcriptroot="https://raw.githubusercontent.com/$gitreposubpath/tools"
|
||||
thisinstallerdistro=amazonlinux
|
||||
repobased=false
|
||||
gitscriptname="installpsh-amazonlinux.psh"
|
||||
pwshlink=/usr/bin/pwsh
|
||||
|
||||
echo
|
||||
echo "*** PowerShell Core Development Environment Installer $VERSION for $thisinstallerdistro"
|
||||
@ -157,19 +158,19 @@ $SUDO yum install -y \
|
||||
echo
|
||||
echo "*** Installing PowerShell Core for $DistroBasedOn..."
|
||||
|
||||
echo "ATTENTION: As of version 1.2.0 this script no longer uses pre-releases unless the '-allowprereleases' switch is used"
|
||||
echo "ATTENTION: As of version 1.2.0 this script no longer uses pre-releases unless the '-preview' switch is used"
|
||||
|
||||
if [[ "'$*'" =~ allowprerelease ]] ; then
|
||||
if [[ "'$*'" =~ preview ]] ; then
|
||||
echo
|
||||
echo "-allowprerelease was used, prereleases will be included in the retrieval of the latest version"
|
||||
echo "-preview was used, the latest preview release will be installed (side-by-side with your production release)"
|
||||
release=`curl https://api.github.com/repos/powershell/powershell/releases/latest | sed '/tag_name/!d' | sed s/\"tag_name\"://g | sed s/\"//g | sed s/v// | sed s/,//g | sed s/\ //g`
|
||||
pwshlink=/usr/bin/pwsh-preview
|
||||
else
|
||||
echo "Finding the latest release production release"
|
||||
echo "Finding the latest production release"
|
||||
release=$(curl https://api.github.com/repos/PowerShell/PowerShell/releases | grep -Po '"tag_name":(\d*?,|.*?[^\\]",)' | grep -Po '\d+.\d+.\d+[\da-z.-]*' | grep -v '[a-z]' | sort | tail -n1)
|
||||
if
|
||||
|
||||
#DIRECT DOWNLOAD
|
||||
pwshlink=/usr/bin/pwsh
|
||||
package=powershell-${release}-linux-x64.tar.gz
|
||||
downloadurl=https://github.com/PowerShell/PowerShell/releases/download/v$release/$package
|
||||
|
||||
|
@ -24,6 +24,7 @@ gitreposcriptroot="https://raw.githubusercontent.com/$gitreposubpath/tools"
|
||||
thisinstallerdistro=debian
|
||||
repobased=true
|
||||
gitscriptname="installpsh-debian.psh"
|
||||
powershellpackageid=powershell
|
||||
|
||||
echo ;
|
||||
echo "*** PowerShell Core Development Environment Installer $VERSION for $thisinstallerdistro"
|
||||
@ -122,9 +123,10 @@ if ! hash curl 2>/dev/null; then
|
||||
$SUDO apt-get install -y curl
|
||||
fi
|
||||
|
||||
if [[ "'$*'" =~ allowprerelease ]] ; then
|
||||
if [[ "'$*'" =~ preview ]] ; then
|
||||
echo
|
||||
echo "-allowprerelease was used, but since $DistroBasedOn uses repositories - selection of releases will depend on the repository contents."
|
||||
echo "-preview was used, the latest preview release will be installed (side-by-side with your production release)"
|
||||
powershellpackageid=powershell-preview
|
||||
fi
|
||||
|
||||
release=`curl https://api.github.com/repos/powershell/powershell/releases/latest | sed '/tag_name/!d' | sed s/\"tag_name\"://g | sed s/\"//g | sed s/v// | sed s/,//g | sed s/\ //g`
|
||||
@ -170,7 +172,7 @@ esac
|
||||
# Update apt-get
|
||||
$SUDO apt-get update
|
||||
# Install PowerShell
|
||||
$SUDO apt-get install -y powershell
|
||||
$SUDO apt-get install -y ${powershellpackageid}
|
||||
|
||||
pwsh -noprofile -c '"Congratulations! PowerShell is installed at $PSHOME.
|
||||
Run `"pwsh`" to start a PowerShell session."'
|
||||
|
@ -24,6 +24,7 @@ gitreposcriptroot="https://raw.githubusercontent.com/$gitreposubpath/tools"
|
||||
thisinstallerdistro=osx
|
||||
repobased=true
|
||||
gitscriptname="installpsh-osx.sh"
|
||||
powershellpackageid=powershell
|
||||
|
||||
echo "*** PowerShell Core Development Environment Installer $VERSION for $thisinstallerdistro"
|
||||
echo "*** Current PowerShell Core Version: $currentpshversion"
|
||||
@ -88,9 +89,10 @@ fi
|
||||
|
||||
echo "*** Installing PowerShell Core for $DistroBasedOn..."
|
||||
|
||||
if [[ "'$*'" =~ allowprerelease ]] ; then
|
||||
if [[ "'$*'" =~ preview ]] ; then
|
||||
echo
|
||||
echo "-allowprerelease was used, but since $DistroBasedOn uses repositories - selection of releases will depend on the repository contents."
|
||||
echo "-preview was used, the latest preview release will be installed (side-by-side with your production release)"
|
||||
powershellpackageid=powershell-preview
|
||||
fi
|
||||
|
||||
if ! hash brew 2>/dev/null; then
|
||||
@ -136,7 +138,7 @@ fi
|
||||
|
||||
if ! hash pwsh 2>/dev/null; then
|
||||
echo "Installing PowerShell..."
|
||||
if ! brew cask install powershell; then
|
||||
if ! brew cask install ${powershellpackageid}; then
|
||||
echo "ERROR: PowerShell failed to install! Cannot install powershell..." >&2
|
||||
fi
|
||||
else
|
||||
|
@ -25,6 +25,7 @@ gitreposcriptroot="https://raw.githubusercontent.com/$gitreposubpath/tools"
|
||||
thisinstallerdistro=redhat
|
||||
repobased=true
|
||||
gitscriptname="installpsh-redhat.psh"
|
||||
powershellpackageid=powershell
|
||||
|
||||
echo
|
||||
echo "*** PowerShell Core Development Environment Installer $VERSION for $thisinstallerdistro"
|
||||
@ -107,9 +108,10 @@ if (( $EUID != 0 )); then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "'$*'" =~ allowprerelease ]] ; then
|
||||
if [[ "'$*'" =~ preview ]] ; then
|
||||
echo
|
||||
echo "-allowprerelease was used, but since $DistroBasedOn uses repositories - selection of releases will depend on the repository contents."
|
||||
echo "-preview was used, the latest preview release will be installed (side-by-side with your production release)"
|
||||
powershellpackageid=powershell-preview
|
||||
fi
|
||||
|
||||
release=`curl https://api.github.com/repos/powershell/powershell/releases/latest | sed '/tag_name/!d' | sed s/\"tag_name\"://g | sed s/\"//g | sed s/v// | sed s/,//g | sed s/\ //g`echo
|
||||
@ -124,7 +126,7 @@ echo "*** Current version on git is: $release, repo version may differ slightly.
|
||||
|
||||
echo "*** Setting up PowerShell Core repo..."
|
||||
$SUDO curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/microsoft.repo
|
||||
$SUDO yum install -y powershell
|
||||
$SUDO yum install -y ${powershellpackageid}
|
||||
|
||||
pwsh -noprofile -c '"Congratulations! PowerShell is installed at $PSHOME.
|
||||
Run `"pwsh`" to start a PowerShell session."'
|
||||
|
@ -25,6 +25,8 @@ gitreposcriptroot="https://raw.githubusercontent.com/$gitreposubpath/tools"
|
||||
thisinstallerdistro=suse
|
||||
repobased=false
|
||||
gitscriptname="installpsh-suse.psh"
|
||||
powershellpackageid=powershell
|
||||
pwshlink=/usr/bin/pwsh
|
||||
|
||||
echo
|
||||
echo "*** PowerShell Core Development Environment Installer $VERSION for $thisinstallerdistro"
|
||||
@ -139,16 +141,22 @@ $SUDO zypper --non-interactive install \
|
||||
echo
|
||||
echo "*** Installing PowerShell Core for $DistroBasedOn..."
|
||||
|
||||
echo "ATTENTION: As of version 1.2.0 this script no longer uses pre-releases unless the '-allowprereleases' switch is used"
|
||||
echo "ATTENTION: As of version 1.2.0 this script no longer uses pre-releases unless the '-preview' switch is used"
|
||||
|
||||
if [[ "'$*'" =~ allowprerelease ]] ; then
|
||||
if [[ "'$*'" =~ preview ]] ; then
|
||||
echo
|
||||
echo "-allowprerelease was used, prereleases will be included in the retrieval of the latest version"
|
||||
echo "-preview was used, the latest preview release will be installed (side-by-side with your production release)"
|
||||
release=`curl https://api.github.com/repos/powershell/powershell/releases/latest | sed '/tag_name/!d' | sed s/\"tag_name\"://g | sed s/\"//g | sed s/v// | sed s/,//g | sed s/\ //g`
|
||||
pwshlink=/usr/bin/pwsh-preview
|
||||
else
|
||||
echo "Finding the latest release production release"
|
||||
echo "Finding the latest production release"
|
||||
release=$(curl https://api.github.com/repos/PowerShell/PowerShell/releases | grep -Po '"tag_name":(\d*?,|.*?[^\\]",)' | grep -Po '\d+.\d+.\d+[\da-z.-]*' | grep -v '[a-z]' | sort | tail -n1)
|
||||
if
|
||||
#DIRECT DOWNLOAD
|
||||
package=powershell-${release}-linux-x64.tar.gz
|
||||
downloadurl=https://github.com/PowerShell/PowerShell/releases/download/v$release/$package
|
||||
|
||||
|
||||
#REPO BASED (Not ready yet)
|
||||
#echo "*** Setting up PowerShell Core repo..."
|
||||
#echo "*** Current version on git is: $release, repo version may differ slightly..."
|
||||
@ -161,11 +169,6 @@ if
|
||||
## Install PowerShell
|
||||
#$SUDO zypper --non-interactive install powershell
|
||||
|
||||
#DIRECT DOWNLOAD
|
||||
pwshlink=/usr/bin/pwsh
|
||||
package=powershell-${release}-linux-x64.tar.gz
|
||||
downloadurl=https://github.com/PowerShell/PowerShell/releases/download/v$release/$package
|
||||
|
||||
echo "Destination file: $package"
|
||||
echo "Source URL: $downloadurl"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user