Skip to content

Commit

Permalink
Implement chocolatey#1060
Browse files Browse the repository at this point in the history
- Add a ScriptBlock parameter to Install-ChocolateyPackage.ps1 that if present, is called after download but before install.
  • Loading branch information
flcdrg committed Oct 27, 2017
1 parent eaedc2b commit f4aabcd
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,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.9+.
Use this for starting an auxilary process such as AutoHotkey, so that any timeouts are not
affected by the time to download.
.EXAMPLE
>
$packageName= 'bob'
Expand Down Expand Up @@ -287,6 +294,8 @@ 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 @@ -333,6 +342,10 @@ param(
-GetOriginalFileName
}

if ($beforeInstall) {
& $beforeInstall
}

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

0 comments on commit f4aabcd

Please sign in to comment.