Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
* stable:
  (maint) installer messages / checks
  (GH-303) Additional fixes for process env vars
  (doc) update changelog
  • Loading branch information
ferventcoder committed Apr 11, 2016
2 parents 3d814ff + fd2eea1 commit 8897359
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Here's one you probably never knew existed - extensions. Chocolatey has had the

We redesigned our `choco new` default packaging template and we've made managing templates as easy as managing packages.

`choco search`/`choco list` got so many enhancements, you may not need to visit dot org again. [See it in action](https://github.com/chocolatey/choco/wiki/CommandsList#see-it-in-action).
`choco search`/`choco list` has so many enhancements, you may not need to visit dot org again. [See it in action](https://github.com/chocolatey/choco/wiki/CommandsList#see-it-in-action).
* [search -v provides moderation related information and a world of nuspec information](https://github.com/chocolatey/choco/issues/493)
* [search by id only](https://github.com/chocolatey/choco/issues/663)
* [search by id exact](https://github.com/chocolatey/choco/issues/453)
Expand Down
15 changes: 10 additions & 5 deletions nuget/chocolatey/tools/chocolateysetup.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -487,15 +487,18 @@ function Get-FileEncoding($Path) {
}

function Add-ChocolateyProfile {
Write-Debug "Add-ChocolateyProfile"
try {
$profileFile = "$profile"
$profileDirectory = (Split-Path -Parent $profileFile)

if (!(Test-Path($profileDirectory))) {
Write-Debug "Creating '$profileDirectory'"
New-Item "$profileDirectory" -Type Directory -Force -ErrorAction SilentlyContinue | Out-Null
}

if (!(Test-Path($profileFile))) {
Write-Debug "Creating '$profileFile'"
"" | Out-File $profileFile -Encoding UTF8

}
Expand Down Expand Up @@ -547,8 +550,9 @@ param(
# we can't take advantage of any chocolatey module functions, because they
# haven't been unpacked because they require .NET Framework 4.0

Write-Debug "Install-DotNet4IfMissing"
if ([IntPtr]::Size -eq 8) {$fx="framework64"} else {$fx="framework"}
Write-Debug "Install-DotNet4IfMissing called with `$forceFxInstall=$forceFxInstall"
$NetFxArch = "Framework"
if ([IntPtr]::Size -eq 8) {$NetFxArch="Framework64" }

$NetFx4ClientUrl = 'http://download.microsoft.com/download/5/6/2/562A10F9-C9F4-4313-A044-9C94E0A8FAC8/dotNetFx40_Client_x86_x64.exe'
$NetFx4FullUrl = 'http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe'
Expand All @@ -557,7 +561,8 @@ param(
$NetFx4InstallerFile = 'dotNetFx40_Full_x86_x64.exe'
$NetFx4Installer = Join-Path $NetFx4Path $NetFx4InstallerFile

if(!(test-path "$env:windir\Microsoft.Net\$fx\v4.0.30319") -or $forceFxInstall) {
if ((!(Test-Path "$env:SystemRoot\Microsoft.Net\$NetFxArch\v4.0.30319") -and !(Test-Path "C:\Windows\Microsoft.Net\$NetFxArch\v4.0.30319")) -or $forceFxInstall) {
Write-Output "'$env:SystemRoot\Microsoft.Net\$NetFxArch\v4.0.30319' was not found or this is forced"
if (!(Test-Path $NetFx4Path)) {
Write-Output "Creating folder `'$NetFx4Path`'"
$null = New-Item -Path "$NetFx4Path" -ItemType Directory
Expand All @@ -582,11 +587,11 @@ param(
$s = [System.Diagnostics.Process]::Start($psi);
$s.WaitForExit();
if ($s.ExitCode -ne 0 -and $s.ExitCode -ne 3010) {
if ($netFx4InstallTries -eq 2) {
if ($netFx4InstallTries -ge 2) {
Write-ChocolateyError ".NET Framework install failed with exit code `'$($s.ExitCode)`'. `n This will cause the rest of the install to fail."
throw "Error installing .NET Framework 4.0 (exit code $($s.ExitCode)). `n Please install the .NET Framework 4.0 manually and then try to install Chocolatey again. `n Download at `'$NetFx4Url`'"
} else {
Write-ChocolateyWarning "First try of .NET framework install failed with exit code `'$($s.ExitCode)`'. Trying again."
Write-ChocolateyWarning "Try #$netFx4InstallTries of .NET framework install failed with exit code `'$($s.ExitCode)`'. Trying again."
Install-DotNet4IfMissing $true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ param(
[string] $USER_ENVIRONMENT_REGISTRY_KEY_NAME = "Environment";
[Microsoft.Win32.RegistryKey] $win32RegistryKey = [Microsoft.Win32.Registry]::CurrentUser.OpenSubKey($USER_ENVIRONMENT_REGISTRY_KEY_NAME)
} elseif ($Scope -eq [System.EnvironmentVariableTarget]::Process) {
[Environment]::GetEnvironmentVariable($Name, $Scope)
return [Environment]::GetEnvironmentVariable($Name, $Scope)
}

[Microsoft.Win32.RegistryValueOptions] $registryValueOptions = [Microsoft.Win32.RegistryValueOptions]::None
Expand All @@ -64,7 +64,7 @@ param(
[string] $environmentVariableValue = [string]::Empty

try {
Write-Verbose "Getting environment variable $Name"
#Write-Verbose "Getting environment variable $Name"
$environmentVariableValue = $win32RegistryKey.GetValue($Name, [string]::Empty, $registryValueOptions)
} catch {
Write-Debug "Unable to retrieve the $Name environment variable. Details: $_"
Expand Down

0 comments on commit 8897359

Please sign in to comment.