ps/Modules/Alkami.PowerShell.Choco/Public/Install-ManualChocoPackages.ps1

33 lines
1.1 KiB
PowerShell
Raw Normal View History

2023-05-30 22:51:22 -07:00
function Install-ManualChocoPackages {
<#
.SYNOPSIS
Runs a chocolatey install script for packages that must be installed manually.
For now this includes new packages, and packages that have database migrations.
#>
[CmdletBinding()]
Param(
[Parameter(Mandatory=$false)]
[string]$commandsPath = "C:/temp/deploy/chocoInstallCommands.ps1"
)
$logLead = (Get-LogLeadName);
if(!(Test-Path $commandsPath))
{
Write-Warning "$logLead Chocolatey install script $commandsPath was not found."
}
else
{
Write-Host "$logLead Executing install script at $commandsPath"
& $commandsPath
Write-Host "$logLead Install script has run successfully. Backing up choco commands file."
$fileInfo = Get-ChildItem $commandsPath
$newPath = Join-Path $fileInfo.DirectoryName ("backup-" + $fileInfo.Name)
Write-Host "$logLead Saving backup choco command file to $newPath"
Move-Item -Path $commandsPath -Destination $newPath -force
Write-Host "$logLead Backup complete."
}
}