From 2aae04a6591e4345cb3bb7e167bcb669dee3a8e7 Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Thu, 12 Sep 2019 11:25:30 -0700 Subject: [PATCH] Prevent the installation of the same version we have. (#10489) * Prevent the installation of the same version we have. * update the buildinfo to be an aka.ms url * convert tab to spaces * spaces not tabs --- tools/install-powershell.ps1 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/install-powershell.ps1 b/tools/install-powershell.ps1 index a09fffd67c..42d56384c0 100644 --- a/tools/install-powershell.ps1 +++ b/tools/install-powershell.ps1 @@ -244,10 +244,21 @@ try { [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 if ($Daily) { - $metadata = Invoke-RestMethod https://pscoretestdata.blob.core.windows.net/buildinfo/daily.json + $metadata = Invoke-RestMethod 'https://aka.ms/pwsh-buildinfo-daily' $release = $metadata.ReleaseTag -replace '^v' $blobName = $metadata.BlobName + # Get version from currently installed PowerShell Daily if available. + $pwshPath = Join-Path $Destination "pwsh" + $currentlyInstalledVersion = if(Test-Path $pwshPath) { + ((& $pwshPath -version) -split " ")[1] + } + + if($currentlyInstalledVersion -eq $release) { + Write-Verbose "Latest PowerShell Daily already installed." -Verbose + return + } + if ($IsWinEnv) { if ($UseMSI) { $packageName = "PowerShell-${release}-win-${architecture}.msi"