From f55f5a5fe8f8ef40bab4ec772a9dd0a7529bb142 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Thu, 27 Jul 2023 00:36:34 +0530 Subject: bootstrap-windows.ps1: Fix check for existing choco install choco is not in PATH by default when installed by us. Part-of: --- tools/bootstrap-windows.ps1 | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/bootstrap-windows.ps1 b/tools/bootstrap-windows.ps1 index 8b60018c..8df2c967 100644 --- a/tools/bootstrap-windows.ps1 +++ b/tools/bootstrap-windows.ps1 @@ -89,14 +89,17 @@ function Install-VS { Get-Date -if (!(Is-Newer 'choco' '0.0')) { - Write-Host "Installing Chocolatey" - Invoke-Expression ((New-Object System.Net.WebClient).DownloadString($choco_url)) - Import-Module "$env:ProgramData\chocolatey\helpers\chocolateyProfile.psm1" +$choco_psm = "$env:ProgramData\chocolatey\helpers\chocolateyProfile.psm1" +if (Test-Path $choco_psm) { + Import-Module $choco_psm Update-SessionEnvironment -} else { Write-Host "Found Chocolatey, upgrading it first" choco upgrade -y chocolatey +} else { + Write-Host "Installing Chocolatey" + Invoke-Expression ((New-Object System.Net.WebClient).DownloadString($choco_url)) + Import-Module $choco_psm + Update-SessionEnvironment } choco feature enable --name="'useEnhancedExitCodes'" -- cgit v1.2.3