Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(GH-1060) Add BeforeInstall parameter to Install-ChocolateyPackage.ps1 #1436

Merged
merged 1 commit into from
Apr 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,13 @@ functionality (see links).
.PARAMETER IgnoredArguments
Allows splatting with arguments that do not apply. Do not use directly.

.PARAMETER BeforeInstall Script
Specifies the commands to run after download has completed but before install steps have begun.
Available in 0.10.16+.

Use this for starting an auxilary process such as AutoHotkey, so that any timeouts are not
affected by the time to download.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note for consistency - we put parameter docs in the order they appear. This should later be moved ABOVE IgnoredArguments.

.EXAMPLE
>
$packageName= 'bob'
Expand Down Expand Up @@ -359,6 +366,7 @@ param(
[parameter(Mandatory=$false)]
[alias("useOnlyPackageSilentArgs")][switch] $useOnlyPackageSilentArguments = $false,
[parameter(Mandatory=$false)][switch]$useOriginalLocation,
[parameter(Mandatory=$false)][scriptblock] $beforeInstall,
[parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments
)
[string]$silentArgs = $silentArgs -join ' '
Expand Down Expand Up @@ -405,6 +413,10 @@ param(
-GetOriginalFileName
}

if ($beforeInstall) {
& $beforeInstall
}

Install-ChocolateyInstallPackage -PackageName $packageName `
-FileType $fileType `
-SilentArgs $silentArgs `
Expand Down