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.
  • Loading branch information
gep13 committed May 5, 2021
1 parent 052227b commit 2f07a6c
Showing 1 changed file with 14 additions and 3 deletions.
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 @@ -325,7 +325,18 @@ 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 All @@ -334,7 +345,7 @@ Pro / Business supports a single, ubiquitous install directory option.
$msiArgs = "$msiArgs $silentArgs $additionalInstallArgs";
}

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

if ($fileType -like 'exe') {
Expand Down

0 comments on commit 2f07a6c

Please sign in to comment.