Skip to content

Commit

Permalink
more chocolatey isolation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mwrock committed Jul 1, 2015
1 parent 39e3ea1 commit ec03994
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Boxstarter.Chocolatey/install-chocolatey.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,28 @@ function Install-Chocolatey($pkgUrl) {
}

$PSModuleAutoLoadingPreference = "All"
$boxBinPath = Join-Path $Boxstarter.VendoredChocoPath 'bin'
$chocoBinPath = Join-Path $currentChocoInstall 'bin'

Import-Module $chocInstallModule
Initialize-Chocolatey $Boxstarter.VendoredChocoPath
Set-Content -Path (Join-Path $Boxstarter.VendoredChocoPath 'ChocolateyInstall/functions/boxstarter_patch.ps1') -value @"
`$nugetExePath = "$(Join-Path $currentChocoInstall 'bin')"
`$nugetExePath = "$chocoBinPath"
`$nugetLibPath = "$(Join-Path $currentChocoInstall 'lib')"
`$badLibPath = "$(Join-Path $currentChocoInstall 'lib-bad')"
"@

if(!(Test-Path $chocoBinPath)){
Copy-Item -Path $boxBinPath -Destination $chocoBinPath -Recurse
}

$currentEnv = [Environment]::GetEnvironmentVariable('path', 'Machine')
$newEnv = $currentEnv.Replace($boxBinPath, '')
if($newEnv.IndexOf($chocoBinPath) -eq -1) {
$newEnv += $chocoBinPath + ';'
}
$newEnv = $newEnv.Replace(';;', ';')
[Environment]::SetEnvironmentVariable("path", $newEnv, 'Machine')
}
finally {
$env:ChocolateyInstall = $currentChocoInstall
Expand Down

0 comments on commit ec03994

Please sign in to comment.