Skip to content

Instantly share code, notes, and snippets.

@tylergannon
Last active June 23, 2018 00:28
Show Gist options
  • Save tylergannon/6b2d0cef9918bebfaa6254f15c66eed4 to your computer and use it in GitHub Desktop.
Save tylergannon/6b2d0cef9918bebfaa6254f15c66eed4 to your computer and use it in GitHub Desktop.
Install base components for Kubo
& {
$wid=[System.Security.Principal.WindowsIdentity]::GetCurrent()
$prp=new-object System.Security.Principal.WindowsPrincipal($wid)
$adm=[System.Security.Principal.WindowsBuiltInRole]::Administrator
$IsAdmin=$prp.IsInRole($adm)
if (-not $IsAdmin)
{
Write-Host -ForegroundColor Yellow "This needs to be run as administrator."
Write-Host -ForegroundColor Yellow "Please open a new powershell as administrator, and try again."
exit 2
}
else
{
$install = "acrylic-dns-proxy poshgit vagrant-manager"
foreach ($program in @("git", "vagrant", "virtualbox", "vim")) {
if (Get-Command -Name "${program}.exe" -ErrorAction SilentlyContinue) {
Write-Host "Not installing ${program} bc it appears to already be installed."
} else {
$install = "${install} ${program}"
}
}
foreach ($program in @("github", "googlechrome", "vscode")) {
$doIt = Read-Host -Prompt "Shall I install the ${program} App? (y/N)"
if ($doIt -match "^y") { $install = "${install} ${program}" }
}
Write-Host -ForegroundColor DarkMagenta "Point DNS settings at localhost? (Y/n)"
$changeDns = Read-Host -Prompt "Choose yes if you don't know the answer."
Write-Host ""
Write-Host "Now is a good time to get a cup of coffee."
Invoke-Expression -Command "choco.exe install -y $install"
$hostsFile = "C:\Program Files (x86)\Acrylic DNS Proxy\AcrylicHosts.txt"
'192.168.56.4 >dev' | Out-File -Encoding ASCII -Append $hostsFile
if (-not ($changeDns -match "^(n|N)")) {
$connection = netsh interface ip show interfaces |
Where-Object {$_ -match " connected"} |
Where-Object {(-not ($_ -match "Loopback")) -and (-not ($_ -match "VirtualBox"))} |
Select-Object -First 1
$connectionName = [regex]::Match($connection, "connected (.*)$").captures.groups[1].value
netsh.exe interface ip set dns "${connectionName}" static 127.0.0.1
Write-Host -ForegroundColor DarkYellow "Done."
}
Write-Host "Done. Woo hoo! Better restart your computer now."
}
}
@tylergannon
Copy link
Author

$file = [System.IO.Path]::GetTempFileName(); (New-Object System.Net.WebClient).DownloadString('https://kubobuild.page.link/base') | Out-File -FilePath "${file}.ps1"; . "${file}.ps1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment