-
Notifications
You must be signed in to change notification settings - Fork 905
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(GH-207) Set up variables for powershell scripts
Prior to calling the script, we need to set up variables so they are available. To do that we redirect the call to a known powershell script that will call the install/uninstall script. In this known script we set up all of the variables appropriately so they are already set when we call the actual script from the known script.
- Loading branch information
1 parent
8f5ee90
commit aa89825
Showing
3 changed files
with
51 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/chocolatey.resources/helpers/chocolateyScriptRunner.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
param( | ||
[alias("ia","installArgs")][string] $installArguments = '', | ||
[alias("o","override","overrideArguments","notSilent")] | ||
[switch] $overrideArgs = $false, | ||
[alias("x86")][switch] $forceX86 = $false, | ||
[alias("params")][alias("parameters")][alias("pkgParams")][string]$packageParameters = '', | ||
[string]$packageScript | ||
) | ||
|
||
Write-Debug "Running 'ChocolateyScriptRunner' for $($env:packageName) v$($env:packageVersion) with packageScript `'$packageScript`', packageFolder:`'$($env:packageFolder)`', installArguments: `'$installArguments`', packageParameters: `'$packageParameters`'," | ||
|
||
## Set the culture to invariant | ||
$currentThread = [System.Threading.Thread]::CurrentThread; | ||
$culture = [System.Globalization.CultureInfo]::InvariantCulture; | ||
$currentThread.CurrentCulture = $culture; | ||
$currentThread.CurrentUICulture = $culture; | ||
|
||
$RunNote = "DarkCyan" | ||
$Warning = "Magenta" | ||
$ErrorColor = "Red" | ||
$Note = "Green" | ||
|
||
$version = $env:packageVersion | ||
$packageName = $env:packageName | ||
$packageFolder = $env:packageFolder | ||
|
||
Write-Debug "Running `'$packageScript`'"; | ||
& "$packageScript" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aa89825
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gep13 this