mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-15 02:19:39 +01:00
Update install-powershell.ps1
This commit is contained in:
parent
04406716db
commit
3dba184d19
@ -117,7 +117,7 @@ function Remove-Destination([string] $Destination) {
|
|||||||
if ($DoNotOverwrite) {
|
if ($DoNotOverwrite) {
|
||||||
throw "Destination folder '$Destination' already exist. Use a different path or omit '-DoNotOverwrite' to overwrite."
|
throw "Destination folder '$Destination' already exist. Use a different path or omit '-DoNotOverwrite' to overwrite."
|
||||||
}
|
}
|
||||||
Write-Host "⏳ (5/5) Removing old installation at: $Destination"
|
Write-Host "⏳ (4/4) Removing old installation at $Destination"
|
||||||
if (Test-Path -Path "$Destination.old") {
|
if (Test-Path -Path "$Destination.old") {
|
||||||
Remove-Item "$Destination.old" -Recurse -Force
|
Remove-Item "$Destination.old" -Recurse -Force
|
||||||
}
|
}
|
||||||
@ -350,14 +350,13 @@ try {
|
|||||||
tar zxf $packagePath -C $contentPath
|
tar zxf $packagePath -C $contentPath
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Write-Host "⏳ (1/5) Loading metadata from https://raw.githubusercontent.com ..."
|
Write-Host "⏳ (1/4) Loading metadata from https://raw.githubusercontent.com ..."
|
||||||
$metadata = Invoke-RestMethod https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/metadata.json
|
$metadata = Invoke-RestMethod https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/metadata.json
|
||||||
if ($Preview) {
|
if ($Preview) {
|
||||||
$release = $metadata.PreviewReleaseTag -replace '^v'
|
$release = $metadata.PreviewReleaseTag -replace '^v'
|
||||||
} else {
|
} else {
|
||||||
$release = $metadata.ReleaseTag -replace '^v'
|
$release = $metadata.ReleaseTag -replace '^v'
|
||||||
}
|
}
|
||||||
Write-Host "⏳ (2/5) Found latest release $release for $architecture..."
|
|
||||||
|
|
||||||
if ($IsWinEnv) {
|
if ($IsWinEnv) {
|
||||||
if ($UseMSI) {
|
if ($UseMSI) {
|
||||||
@ -374,10 +373,10 @@ try {
|
|||||||
} elseif ($IsMacOSEnv) {
|
} elseif ($IsMacOSEnv) {
|
||||||
$packageName = "powershell-${release}-osx-${architecture}.tar.gz"
|
$packageName = "powershell-${release}-osx-${architecture}.tar.gz"
|
||||||
}
|
}
|
||||||
Write-Host "⏳ (3/5) Package name to download is $packageName..."
|
Write-Host "⏳ (2/4) Latest release is $release for $architecture, package name is $packageName ..."
|
||||||
|
|
||||||
$downloadURL = "https://github.com/PowerShell/PowerShell/releases/download/v${release}/${packageName}"
|
$downloadURL = "https://github.com/PowerShell/PowerShell/releases/download/v${release}/${packageName}"
|
||||||
Write-Host "⏳ (4/5) Loading $downloadURL"
|
Write-Host "⏳ (3/4) Loading $downloadURL"
|
||||||
|
|
||||||
$packagePath = Join-Path -Path $tempDir -ChildPath $packageName
|
$packagePath = Join-Path -Path $tempDir -ChildPath $packageName
|
||||||
if (!$PSVersionTable.ContainsKey('PSEdition') -or $PSVersionTable.PSEdition -eq "Desktop") {
|
if (!$PSVersionTable.ContainsKey('PSEdition') -or $PSVersionTable.PSEdition -eq "Desktop") {
|
||||||
@ -504,7 +503,7 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (-not $UseMSI) {
|
if (-not $UseMSI) {
|
||||||
Write-Host "✅ PowerShell has been installed at: $Destination" -noNewline
|
Write-Host "✅ PowerShell $release has been installed at $Destination" -noNewline
|
||||||
if ($Destination -eq $PSHOME) {
|
if ($Destination -eq $PSHOME) {
|
||||||
Write-Host " - Please restart pwsh now."
|
Write-Host " - Please restart pwsh now."
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user