Skip to content

Instantly share code, notes, and snippets.

@rudiejd
Last active April 23, 2020 05:38
Show Gist options
  • Save rudiejd/d608d54ae45c241236f21ae3bda1d9db to your computer and use it in GitHub Desktop.
Save rudiejd/d608d54ae45c241236f21ae3bda1d9db to your computer and use it in GitHub Desktop.
Build script for CSE 201 PlantPro project
# TODO: Edit user's Homestead.yaml file for them,
# start vagrant box and ssh into it to set things up.
# To install all required components: just download and run this powershell script from anywhere on your computer.
function isInstalled {
param (
[string]$name
)
$32BitPrograms = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*
$64BitPrograms = Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*
$programsWithName = ($32BitPrograms + $64BitPrograms) | Where-Object { $null -ne $_.DisplayName -and $_.Displayname.Contains($name) }
$isInstalled = $null -ne $programsWithName
return $isInstalled
}
$chocolateyInstalled = isInstalled("Chocolatey")
if ($chocolateyInstalled -eq $false) {
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
}
$vbInstalled = isInstalled("VirtualBox")
if ($vbInstalled -eq $false) {
choco install virtualbox
}
$vagrantInstalled = isInstalled("Vagrant")
if ($vagrantInstalled -eq $false) {
choco install vagrant
}
$gitInstalled = isInstalled("Git")
if ($gitInstalled -eq $false) {
choco install git
}
vagrant box add laravel/homestead
git clone https://github.com/laravel/homestead.git Homestead
cd Homestead
bash init.sh
Install-Module -Force OpenSSHUtils
Start-Service ssh-agent
Start-Service sshd
ssh-keygen
Write-Output "Everything is installed. Configure your Homestead.yaml file and start the virtual machine. Once you're on the virtual machine, clone the repository and run the setup script."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment