ps/Modules/Cole.PowerShell.Developer/Public/Get-ComponentInstallerInstallPath.ps1

30 lines
1.1 KiB
PowerShell
Raw Permalink Normal View History

2023-05-30 22:51:22 -07:00
function Get-ComponentInstallerInstallPath {
param(
[Parameter(Mandatory=$true)]
[ValidateSet("Widget","Provider","WebExtension","WebApplication","Service")]
[string]$ComponentType
)
$logLead = (Get-LogLeadName)
# Due to a quirk, Service was keyed as Alkami.Installer.Services and not caught early enough
# This is considered acceptable because migrations also need a secondary path option for this routing
$RoutedComponentType = $ComponentType
if ($ComponentType -eq "Service") {
$RoutedComponentType = "Services"
}
$alkamiPDPath = (Join-Path -Path $env:ProgramData -ChildPath "Alkami")
$installerPath = (Join-Path -Path $alkamiPDPath -ChildPath "Installer")
$targetInstallerPath = (Join-Path -Path $installerPath -ChildPath $RoutedComponentType)
$finalPath = (Join-Path -Path $targetInstallerPath -ChildPath "install.ps1")
if (!(Test-Path $finalPath)) {
Write-Warning "$logLead [$ComponentType] : Installer file does not exist. Have you tried [choco upgrade Alkami.Installer.$RoutedComponentType -y] lately?"
}
return $finalPath
}