Last active
August 29, 2015 14:03
-
-
Save ryanrousseau/938f11a760dfbbc76c51 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Write-Output "Checking ChocolateyInstall env variable" | |
$chocolateyInstall = [Environment]::GetEnvironmentVariable("ChocolateyInstall") | |
if (!$chocolateyInstall) { | |
Write-Output "ChocolateyInstall env variable does not exist, using $ChocolateyInstallDir" | |
$chocolateyInstall = $ChocolateyInstallDir | |
[Environment]::SetEnvironmentVariable("ChocolateyInstall", $chocolateyInstall) | |
[Environment]::SetEnvironmentVariable("ChocolateyInstall", $chocolateyInstall, "Machine") | |
} | |
Write-Output "Ensuring the Chocolatey package manager is installed..." | |
$chocolateyBin = "$chocolateyInstall\bin" | |
$chocInstalled = Test-Path "$chocolateyBin\cinst.exe" | |
if (-not $chocInstalled) { | |
Write-Output "Chocolatey not found, installing..." | |
$installPs1 = ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) | |
Invoke-Expression $installPs1 | |
& cmd.exe /C "SET PATH=%PATH%;$chocolateyBin" | |
Write-Output "Chocolatey installation complete." | |
} else { | |
Write-Output "Chocolatey was found at $chocolateyBin and won't be reinstalled." | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment