Skip to content

Commit

Permalink
(#2112) Add msp support to Install helper
Browse files Browse the repository at this point in the history
It's trivial to currently work with MSI installers with chocolately, as
we natively hook into msiexec's silent installation parameters to
complete the installation.

Support for msp files directly is a simple addition, as it uses the same
underlying msiexec installation method, with a slightly modified
parameter set.

Co-authored-by:  Stephen Valdinger <stephen@chocolatey.io>
  • Loading branch information
gep13 and steviecoaster committed May 12, 2021
1 parent 79098d6 commit f68a242
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ Start-ChocolateyProcessAsAdmin
}

$installerTypeLower = $fileType.ToLower()
if ($installerTypeLower -ne 'msi' -and $installerTypeLower -ne 'exe' -and $installerTypeLower -ne 'msu') {
if ($installerTypeLower -notin 'msi', 'exe', 'msu', 'msp') {
Write-Warning "FileType '$fileType' is unrecognized, using 'exe' instead."
$fileType = 'exe'
}
Expand Down Expand Up @@ -326,6 +326,19 @@ Pro / Business supports a single, ubiquitous install directory option.

if ($fileType -like 'msi') {
$msiArgs = "/i `"$fileFullPath`""
$msiArgs = if ($overrideArguments) {
Write-Host "Overriding package arguments with '$additonalInstallArgs' (replacing '$silentArgs')"
"$msiArgs $additionalInstallArgs"
}
else {
"$msiArgs $silentArgs $additionalInstallArgs"
}

$env:ChocolateyExitCode = Start-ChocolateyProcessAsAdmin "$msiArgs" "$($env:SystemRoot)\System32\msiexec.exe" -validExitCodes $validExitCodes -workingDirectory $workingDirectory
}

if ($fileType -like 'msp') {
$msiArgs = '/update "{0}"' -f $fileFullPath
if ($overrideArguments) {
Write-Host "Overriding package arguments with '$additionalInstallArgs' (replacing '$silentArgs')";
$msiArgs = "$msiArgs $additionalInstallArgs";
Expand Down

0 comments on commit f68a242

Please sign in to comment.