ps/install.ps1

41 lines
1.3 KiB
PowerShell
Raw Permalink Normal View History

2023-05-30 22:55:40 -07:00
$chocoPath = (Join-Path $PSScriptRoot "choco")
## See notes below
$DEVOPS_Modules_ChocoOutputPathKey = "DEVOPS_Modules_ChocoOutputPath"
$DEVOPS_Modules_ChocoOutputPath = [System.Environment]::GetEnvironmentVariable($DEVOPS_Modules_ChocoOutputPathKey, "User")
if (!([string]::IsNullOrEmpty($DEVOPS_Modules_ChocoOutputPath))) {
$chocoPath = $DEVOPS_Modules_ChocoOutputPath
}
if (!(Test-Path $chocoPath)) {
(New-Item $chocoPath -ItemType Directory -Force) | Out-Null
}
$nupkgs = (Get-ChildItem $chocoPath *.nupkg -Recurse)
$pwd = Get-Location
cd $chocoPath
foreach ($nupkg in $nupkgs) {
choco upgrade $nupkg -yf
}
Set-Location $pwd
<#
If you want to override the address where these files are built-produced-to, add this to your profile:
C:\Users\<username>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
and update the target folder (in this case z:\choco)
$DEVOPS_Modules_ChocoOutputPathKey = "DEVOPS_Modules_ChocoOutputPath"
$DEVOPS_Modules_ChocoOutputPath = [System.Environment]::GetEnvironmentVariable($DEVOPS_Modules_ChocoOutputPathKey, "User")
if ([string]::IsNullOrEmpty($DEVOPS_Modules_ChocoOutputPath)) {
[System.Environment]::SetEnvironmentVariable($DEVOPS_Modules_ChocoOutputPathKey, "Z:\choco", "User")
}
#>