-
Notifications
You must be signed in to change notification settings - Fork 2
/
install_chocolatey.ps1
34 lines (26 loc) · 1.42 KB
/
install_chocolatey.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
$ChocoInstallPath = "$env:SystemDrive\Chocolatey\bin"
# Put chocolatey on the MACHINE path, vagrant does not have access to user environment variables
$envPath = $env:PATH
if (!$envPath.ToLower().Contains($ChocoInstallPath.ToLower())) {
Write-Host "PATH environment variable does not have `'$ChocoInstallPath`' in it. Adding..."
$ActualPath = [Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::Machine)
$StatementTerminator = ";"
$HasStatementTerminator = $ActualPath -ne $null -and $ActualPath.EndsWith($StatementTerminator)
If (!$HasStatementTerminator -and $ActualPath -ne $null) {$ChocoInstallPath = $StatementTerminator + $ChocoInstallPath}
if (!$ChocoInstallPath.EndsWith($StatementTerminator)) {$ChocoInstallPath += $StatementTerminator}
[Environment]::SetEnvironmentVariable('Path', $ActualPath + $ChocoInstallPath, [System.EnvironmentVariableTarget]::Machine)
}
$env:Path += ";$ChocoInstallPath"
if (!(Test-Path $ChocoInstallPath)) {
# Install chocolatey
iex ((new-object net.webclient).DownloadString('http://chocolatey.org/install.ps1'))
}
# cinst wget java.jdk
# cinst java.jdk -params 'x64=false'
# $resourcesPath = 'c:\vagrantshared\resources'
# $chocoPkgFile = get-childitem $resourcesPath -recurse -include 'chocolatey.*.nupkg' | select -First 1
# if ($chocoPkgFile -ne $null) {
# cinst chocolatey -pre -force -source "$resourcesPath"
# } else {
# cinst chocolatey -pre
# }