Created
December 17, 2014 00:53
-
-
Save mefellows/80b05f8af9fd9f526ec5 to your computer and use it in GitHub Desktop.
Windows Vagrant with Rsync powershell bootstrap script
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-Host -ForegroundColor green "Bootstrapping machine" | |
Write-Host "Setting up package management and installing required packages for Dev." | |
# | |
# Install Choco (if not already installed) + required packages | |
# | |
if ( (Get-Command "choco" -errorAction SilentlyContinue) ) { | |
Write-Host "Chocolatey already installed. Skipping." | |
} else { | |
Write-Host "Installing Chocolatey" | |
$wc=new-object net.webclient; $wp=[system.net.WebProxy]::GetDefaultProxy(); $wp.UseDefaultCredentials=$true; $wc.Proxy=$wp; iex ($wc.DownloadString('https://chocolatey.org/install.ps1')) | |
$env:Path = $env:Path + ";C:\ProgramData\chocolatey\bin" | |
[Environment]::SetEnvironmentVariable( "Path", $env:Path, [System.EnvironmentVariableTarget]::Machine ) | |
} | |
Write-Host "Installing required packages." | |
$packages = @( | |
"git.commandline" | |
"git" | |
"cyg-get" | |
) | |
$packages.ForEach({ cinst $_ }) | |
Write-Host "Packages installed" | |
Write-Host "Configuring Cygwin for use with SSH" | |
# Setup SSH / Rsync for use with Vagrant | |
$OLD_USER_PATH=[Environment]::GetEnvironmentVariable("PATH", [System.EnvironmentVariableTarget]::User) | |
$OLD_MACHINE_PATH=[Environment]::GetEnvironmentVariable("PATH", [System.EnvironmentVariableTarget]::Machine) | |
cyg-get rsync | |
cyg-get openssh | |
$CYG_PATH = "c:\tools\cygwin\;c:\tools\cygwin\bin" | |
[Environment]::SetEnvironmentVariable("PATH", "${OLD_USER_PATH};${CYG_PATH}", "User") | |
[Environment]::SetEnvironmentVariable("PATH", "${OLD_MACHINE_PATH};${CYG_PATH}", "Machine") | |
# TODO: Add to Git Bash Path /c/tools/cygwin/bootstrapping | |
Write-Host "Cygwin configuration complete." | |
Write-Host "Installing Vagrant and friends... This will take a little bit of time" | |
cinst vagrant virtualbox virtualbox.extensionpack | |
Write-Host "Vagrant and friends installed, Installing required Vagrant plugins..." | |
vagrant plugin install vagrant-proxyconf vagrant-hostsupdater | |
Write-Host "Vagrant plugins complete. Pulling down 'talent-search-web' box and importing into Vagrant..." | |
vagrant box add BOX_NAME PATH_TO_BOX | |
Write-Host "Vagrant box downloaded." | |
Write-Host -ForegroundColor green "OK. If there were no exceptions above then you could probably run a 'vagrant up' now!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment