Created
March 26, 2016 00:39
-
-
Save mefellows/7ecee94471238322df5f to your computer and use it in GitHub Desktop.
Bootstrap Vagrant and Rsync on Windows
This file contains 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')) | |
} | |
Write-Host "Installing required packages." | |
choco install cyg-get | |
If ( -not ($env:path | Select-String -SimpleMatch "cygwin") ) { | |
Write-Host "Adding cygwin to path" | |
$userPath = [Environment]::GetEnvironmentVariable("PATH","User") | |
$userPath += ";c:\tools\cygwin\bin" | |
$env:PATH += ";c:\tools\cygwin\bin" # For this session.. | |
[Environment]::SetEnvironmentVariable("PATH", $userPath, "User") # Permanently | |
} | |
Write-Host "Packages installed" | |
Write-Host "Configuring Cygwin for use with SSH" | |
# Setup SSH / Rsync for use with Vagrant | |
C:\tools\cygwin\cygwinsetup.exe --site http://mirror.internode.on.net/pub/cygwin/ --quiet-mode --packages openssh,rsync | |
# TODO: Add to Git Bash Path /c/tools/cygwin/... | |
Write-Host "Cygwin configuration complete." | |
$env:PATH += "c:\tools\cygwin\bin" | |
Write-Host "Installing Vagrant and friends... This will take a little bit of time" | |
if ( -not (Get-Command 'vagrant' -ErrorAction SilentlyContinue)) { | |
choco install vagrant | |
} else { | |
Write-Host "Vagrant already installed" | |
} | |
if ( -not (Test-Path 'C:\Program Files\Oracle\VirtualBox\VBoxManage.exe' -ErrorAction SilentlyContinue)) { | |
choco install virtualbox | |
choco install virtualbox.extensionpack | |
} else { | |
Write-Host "Virtualbox already installed" | |
} | |
RefreshEnv | |
Write-Host "Vagrant and friends installed, Installing required Vagrant plugins..." | |
vagrant plugin install vagrant-proxyconf vagrant-multi-hostsupdater vagrant-hostsupdater | |
Write-Host "Vagrant plugins complete. Pulling down 'talent-search-web' box and importing into Vagrant..." | |
vagrant box add MY_MACHINE_NAME file:////path\to\machine.box | |
Write-Host "Vagrant box downloaded." | |
Write-Host -ForegroundColor green "OK. If there were no exceptions above then you could open up a NEW powershell session and run a 'vagrant up' now!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Surprised you don't use Boxstarter to do this yet as I see you have a repo for it. :)