-
-
Save gpuido/321f0cc601a330c64488315327047828 to your computer and use it in GitHub Desktop.
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
### | |
### Save this file as "install-software.ps1" | |
### | |
# check for elevated powershell | |
write-host -nonewline -fore cyan "Info: Verifying user is elevated:" | |
If (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { | |
write-host -fore Red "NO" | |
return write-error "You must run this script elevated." | |
} | |
write-host -fore Yellow "YES" | |
write-host -fore cyan "Info: making temp directory." | |
$null = mkdir -ea 0 c:\tmp | |
Function Get-AndroidHomeFromRegistry | |
{ | |
if ([environment]::GetEnvironmentVariable("ProgramFiles(x86)")) { | |
$androidRegistryKey = "HKLM:\SOFTWARE\Wow6432Node\Android SDK Tools" | |
} | |
else { | |
$androidRegistryKey = "HKLM:\SOFTWARE\Android SDK Tools" | |
} | |
if (Test-Path $androidRegistryKey) { | |
$path = (Get-ItemProperty $androidRegistryKey Path).Path | |
if (-not (Test-Path -ea 0 $path)) { | |
$path = $null | |
} | |
} | |
return $path | |
} | |
function DiffPathFromRegistry { | |
$u = ([System.Environment]::GetEnvironmentVariable( "path", 'User')) | |
$m = ([System.Environment]::GetEnvironmentVariable( "path", 'Machine')) | |
$newPath = "$m;$u" | |
$np = $newpath.split(";") |% { $_.trim("\").Trim() } | |
$op = $env:path.split(";") |% { $_.trim("\").Trim() } | |
diff $np $op | |
} | |
function ReloadPathFromRegistry { | |
write-host -fore darkcyan " Reloading Path From Registry." | |
$u = ([System.Environment]::GetEnvironmentVariable( "path", 'User')) | |
$m = ([System.Environment]::GetEnvironmentVariable( "path", 'Machine')) | |
$newPath = "$m;$u" | |
$env:path = $newPath | |
} | |
function GetEnvironmentFromRegistry { | |
([System.Environment]::GetEnvironmentVariables( 'User')) | |
([System.Environment]::GetEnvironmentVariables( 'Machine')) | |
} | |
# install chocolatey oneget provider | |
write-host -fore cyan "Info: Ensuring Chocolatey OneGet provider is installed." | |
$pp = get-packageprovider -force chocolatey | |
if( !$pp ) { return write-error "can't get chocolatey package provider "} | |
# start with a clean slate. | |
ReloadPathFromRegistry | |
# install jdk8 | |
if( !(get-command -ea 0 java.exe) ) { | |
write-host -fore cyan "Info: Installing JDK 8." | |
$null = install-package -provider chocolatey jdk8 -force | |
if( !(get-command -ea 0 java.exe) ) { return write-error "No Java in PATH." } | |
} | |
write-host -fore darkcyan " Setting JAVA_HOME environment key." | |
([System.Environment]::SetEnvironmentVariable('JAVA_HOME', (resolve-path "$((get-command -ea 0 javac).Source)..\..\..").Path , "Machine" )) | |
# install Android SDK | |
if( ! (Get-AndroidHomeFromRegistry) ) { | |
write-host -fore cyan "Info: Installing Android SDK." | |
$null = install-package -provider chocolatey android-sdk -force | |
if( ! (Get-AndroidHomeFromRegistry) ) { return write-error "No Android SDK Installed" } | |
# set the environment variable for the user. | |
} | |
write-host -fore darkcyan " setting ANDROID_HOME environment key." | |
([System.Environment]::SetEnvironmentVariable('ANDROID_HOME', (Get-AndroidHomeFromRegistry) ,'Machine')) | |
# Install node.js | |
if( !(get-command -ea 0 node.exe) ) { | |
write-host -fore cyan "Info: Installing NodeJS." | |
(New-Object System.Net.WebClient).DownloadFile("https://github.com/coreybutler/nvm-windows/releases/download/1.1.1/nvm-noinstall.zip", "c:\tmp\nvm.zip" ) | |
mkdir -force -ea 0 "$env:ALLUSERSPROFILE\nvm" | |
Expand-Archive c:\tmp\nvm.zip -DestinationPath "$env:ALLUSERSPROFILE\nvm" | |
$p = ([System.Environment]::GetEnvironmentVariable( "path", 'Machine')) | |
$p = "$p;$env:ALLUSERSPROFILE\nvm;$env:ProgramFiles\nodejs;" | |
([System.Environment]::SetEnvironmentVariable( "path", $p, 'Machine')) | |
ReloadPathFromRegistry | |
$env:NVM_HOME="$env:ALLUSERSPROFILE\nvm" | |
$env:NVM_SYMLINK="$env:ProgramFiles\nodejs" | |
([System.Environment]::SetEnvironmentVariable( "NVM_HOME", "$env:ALLUSERSPROFILE\nvm", 'Machine')) | |
([System.Environment]::SetEnvironmentVariable( "NVM_SYMLINK", "$env:ProgramFiles\nodejs", 'Machine')) | |
set-content -Path "$env:ALLUSERSPROFILE\nvm\settings.txt" -Value "root: $env:ALLUSERSPROFILE\nvm`npath: $env:ProgramFiles\nodejs" | |
nvm install 4.6.2 | |
nvm install 6.9.1 | |
nvm use 4.6.2 | |
if( !(get-command -ea 0 node.exe) ) { return write-error "No NodeJS in PATH." } | |
# use system-wide locations for npm | |
npm config --global set cache "$env:ALLUSERSPROFILE\npm-cache" | |
npm config --global set prefix "$env:ALLUSERSPROFILE\npm" | |
$p = ([System.Environment]::GetEnvironmentVariable( "path", 'Machine')) | |
$p = "$env:ALLUSERSPROFILE\npm;$p" | |
([System.Environment]::SetEnvironmentVariable( "path", $p, 'Machine')) | |
ReloadPathFromRegistry | |
} | |
# install gulp | |
if( !(get-command -ea 0 gulp) ) { | |
write-host -fore cyan "Info: Installing Gulp globally." | |
npm install -g gulp | |
if( !(get-command -ea 0 gulp) ) { return write-error "No gulp in PATH. (npm bin folder missing?)" } | |
} | |
# install Ruby 2.3 | |
if( !(get-command -ea 0 ruby) ) { | |
write-host -fore cyan "Info: Downloading Ruby." | |
( New-Object System.Net.WebClient).DownloadFile("http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.3.1.exe","c:\tmp\rubyinstaller-2.3.1.exe") | |
if( !(test-path -ea 0 "c:\tmp\rubyinstaller-2.3.1.exe" ) ) { return write-error "Unable to download ruby installer" } | |
write-host -fore darkcyan " Running Ruby Installer." | |
C:\tmp\rubyinstaller-2.3.1.exe /verysilent /dir=c:\ruby2.3.1 /tasks="assocfiles,modpath" | |
while( (get-process -ea 0 rubyinstaller*) ) { write-host -NoNewline "." ; sleep 1 } | |
ReloadPathFromRegistry | |
if( !(get-command -ea 0 ruby.exe) ) { return write-error "No RUBY in PATH." } | |
$ruby = (get-command -ea 0 ruby.exe).Source | |
$null = netsh firewall add allowedprogram "$ruby" "$ruby" ENABLE | |
} | |
# 7zip | |
if( ! (test-path -ea 0 "$env:ProgramFiles\7-Zip\7z.exe")) { | |
write-host -fore cyan "Info: Downloading 7zip." | |
( New-Object System.Net.WebClient).DownloadFile("http://www.7-zip.org/a/7z1604-x64.msi", "c:\tmp\7z1604-x64.msi" ); | |
if( !(test-path -ea 0 "c:\tmp\7z1604-x64.msi") ) { return write-error "Unable to download 7zip installer" } | |
write-host -fore darkcyan " Installing 7Zip." | |
Start-Process -wait -FilePath msiexec -ArgumentList "/i", "c:\tmp\7z1604-x64.msi", "/passive" | |
if( ! (test-path -ea 0 "$env:ProgramFiles\7-Zip\7z.exe")) { return write-error "Unable to install 7zip" } | |
} | |
# ruby devkit | |
if( ! (test-path -ea 0 "C:\ruby2.3.1\devkit")) { | |
write-host -fore cyan "Info: Downloading Ruby Devkit." | |
( New-Object System.Net.WebClient).DownloadFile("http://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe", "c:\tmp\DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe" ) | |
if( !(test-path -ea 0 "c:\tmp\DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe") ) { return write-error "Unable to download ruby devkit" } | |
write-host -fore darkcyan " Unpacking ruby devkit." | |
&"$env:ProgramFiles\7-Zip\7z" x C:\tmp\DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe -oC:\ruby2.3.1\devkit | |
pushd C:\ruby2.3.1\devkit\ | |
write-host -fore darkcyan " Installing ruby devkit." | |
ruby dk.rb init | |
ruby dk.rb install | |
write-host -fore darkcyan " Installing missing ruby certificate roots." | |
set-content -path "c:\ruby2.3.1\lib\ruby\2.3.0\rubygems\ssl_certs\fastly.pem" -value @" | |
-----BEGIN CERTIFICATE----- | |
MIIO5DCCDcygAwIBAgISESFY8xfYRUgn/tM1S/rCQFqRMA0GCSqGS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bS9bZvlxrFUaKnjaZC2mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Un | |
hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV | |
5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw== | |
-----END CERTIFICATE----- | |
"@ | |
set-content -path "c:\ruby2.3.1\lib\ruby\2.3.0\rubygems\ssl_certs\GlobalSignRoot.pem" -value @" | |
-----BEGIN CERTIFICATE----- | |
MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx | |
GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds | |
b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV | |
BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD | |
VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa | |
DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc | |
THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb | |
Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP | |
c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX | |
gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV | |
HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF | |
AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj | |
Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG | |
j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH | |
hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC | |
X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A== | |
-----END CERTIFICATE----- | |
"@ | |
write-host -fore darkcyan " Testing ruby devkit." | |
gem install json --platform=ruby | |
$answer = ruby -rubygems -e "require 'json'; puts JSON.load('[42]').inspect" | |
if( $answer -ne "[42]") { | |
return write-error "Ruby devkit/gems not working?" | |
} | |
gem install bundle | |
} | |
# install python 2.7 and 3.5 | |
if( !(get-command -ea 0 python.exe) ) { | |
write-host -fore cyan "Info: Downloading Python 2.7 and 3.5" | |
( New-Object System.Net.WebClient).DownloadFile("https://www.python.org/ftp/python/2.7.12/python-2.7.12.amd64.msi","c:\tmp\python-2.7.12.amd64.msi") | |
( New-Object System.Net.WebClient).DownloadFile("https://www.python.org/ftp/python/3.5.2/python-3.5.2-amd64.exe","c:\tmp\python-3.5.2-amd64.exe" ) | |
if( !(test-path -ea 0 "c:\tmp\python-2.7.12.amd64.msi") ) { return write-error "Unable to download Python 2.7" } | |
if( !(test-path -ea 0 "c:\tmp\python-3.5.2-amd64.exe") ) { return write-error "Unable to download Python 3.5" } | |
write-host -fore darkcyan " Installing Python 2.7." | |
Start-Process -wait -FilePath msiexec -ArgumentList "/i", "C:\tmp\python-2.7.12.amd64.msi", "TARGETDIR=c:\python27", "ALLUSERS=1", "ADDLOCAL=All", "/passive" | |
write-host -fore darkcyan " Installing Python 3.5." | |
C:\tmp\python-3.5.2-amd64.exe /quiet InstallAllUsers=1 PrependPath=1 | |
while( (get-process -ea 0 python*) ) { write-host -NoNewline "." ; sleep 1 } | |
ReloadPathFromRegistry | |
if( !(get-command -ea 0 python.exe) ) { return write-error "No PYTHON in PATH." } | |
} | |
#install Tox | |
if( !(get-command -ea 0 tox.exe) ) { | |
write-host -fore cyan "Info: Installing Tox" | |
pip install tox | |
if( !(get-command -ea 0 tox.exe) ) { return write-error "No TOX in PATH." } | |
} | |
# install gradle | |
if( !(get-command -ea 0 gradle.bat) ) { | |
write-host -fore cyan "Info: Downloading Gradle" | |
(New-Object System.Net.WebClient).DownloadFile("https://services.gradle.org/distributions/gradle-3.1-all.zip", "c:\tmp\gradle-3.1-all.zip" ) | |
if( !(test-path -ea 0 "c:\tmp\gradle-3.1-all.zip") ) { return write-error "Unable to download Gradle" } | |
write-host -fore darkcyan " Unpacking Gradle." | |
Expand-Archive C:\tmp\gradle-3.1-all.zip -DestinationPath c:\ | |
write-host -fore darkcyan " Adding gradle to system PATH." | |
$p = ([System.Environment]::GetEnvironmentVariable( "path", 'Machine')) | |
$p = "$p;c:\gradle-3.1\bin" | |
([System.Environment]::SetEnvironmentVariable( "path", $p, 'Machine')) | |
ReloadPathFromRegistry | |
if( !(get-command -ea 0 gradle.bat) ) { return write-error "No Gradle in PATH." } | |
} | |
#install go | |
if( !(get-command -ea 0 go.exe) ) { | |
write-host -fore cyan "Info: Downloading Go" | |
(New-Object System.Net.WebClient).DownloadFile("https://storage.googleapis.com/golang/go1.7.1.windows-amd64.msi", "c:\tmp\go1.7.1.windows-amd64.msi" ) | |
if( !(test-path -ea 0 "c:\tmp\go1.7.1.windows-amd64.msi" ) ) { return write-error "Unable to download Go" } | |
write-host -fore darkcyan " Installing Go." | |
Start-Process -wait -FilePath msiexec -ArgumentList "/i", "C:\tmp\go1.7.1.windows-amd64.msi", "/passive" | |
ReloadPathFromRegistry | |
if( !(get-command -ea 0 go.exe) ) { return write-error "No GO in PATH." } | |
} | |
# install glide | |
if( !(get-command -ea 0 glide.exe) ) { | |
write-host -fore cyan "Info: Downloading Glide" | |
(New-Object System.Net.WebClient).DownloadFile("https://github.com/Masterminds/glide/releases/download/v0.11.1/glide-v0.11.1-windows-amd64.zip", "c:\tmp\glide-v0.11.1-windows-amd64.zip" ) | |
if( !(test-path -ea 0 "c:\tmp\glide-v0.11.1-windows-amd64.zip" ) ) { return write-error "Unable to download Glide" } | |
write-host -fore darkcyan " Unpacking Glide." | |
Expand-Archive C:\tmp\glide-v0.11.1-windows-amd64.zip -DestinationPath c:\glide | |
write-host -fore darkcyan " adding glide to system PATH." | |
$p = ([System.Environment]::GetEnvironmentVariable( "path", 'Machine')) | |
$p = "$p;C:\glide\windows-amd64" | |
([System.Environment]::SetEnvironmentVariable( "path", $p, 'Machine')) | |
ReloadPathFromRegistry | |
if( !(get-command -ea 0 glide.exe) ) { return write-error "No glide in PATH." } | |
} | |
# install git | |
if( !(get-command -ea 0 git) ) { | |
write-host -fore cyan "Info: Installing GIT" | |
$null = install-package -provider chocolatey git -force | |
if( !(get-command -ea 0 git) ) { return write-error "No git in PATH." } | |
# it also needs to be in x86. | |
write-host -fore darkcyan " Putting git in x86 program files too." | |
robocopy /mir "$env:ProgramFiles\git" "${env:ProgramFiles(x86)}\git" | |
} | |
write-host -fore cyan "Info: Fixing firewall rules for languages/tools" | |
Get-NetFirewallRule -DisplayName "Remote Desktop*" | Set-NetFirewallRule -enabled true | |
@("java", "javaw", "javaws", "node", "ruby", "go", "glide" ) |% { $app = ((get-command -ea 0 $_).source); $null= netsh firewall add allowedprogram "$app" "$app" ENABLE } | |
<# | |
# visual studio community 14.0 | |
if( ! (test-path -ea 0 "${env:ProgramFiles(x86)}\Microsoft Visual Studio 14.0\" ) ) { | |
write-host -fore cyan "Info: Downloading VS_Community" | |
(New-Object System.Net.WebClient).DownloadFile("https://download.microsoft.com/download/0/B/C/0BC321A4-013F-479C-84E6-4A2F90B11269/vs_community.exe" , "c:\tmp\vs_community.exe") | |
if( !(test-path -ea 0 "c:\tmp\vs_community.exe") ) { return write-error "Unable to download VS 2015 community" } | |
write-host -fore darkcyan " Installing VS Community (full install) -- this may take around 90 minutes" | |
C:\tmp\vs_community.exe /full /norestart /q | |
while( get-process vs_* ) { write-host -NoNewline "." ; sleep 1 } | |
} | |
#> | |
<# vs 2017 | |
if( ! (test-path -ea 0 "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2017\" ) ) { | |
write-host -fore cyan "Info: Downloading VS_Community 2017" | |
...??? | |
} | |
#> | |
# disable strong naming on the build server. | |
write-host -fore cyan "Info: Turning off strong name verification (for testing)" | |
$null = &"${env:ProgramFiles(x86)}\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\sn.exe" -Vr * | |
$null = &"${env:ProgramFiles(x86)}\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64\sn.exe" -Vr * | |
# visual studio code | |
if( !(get-command -ea 0 code) ) { | |
write-host -fore cyan "Info: Downloading Visual Studio Code" | |
(New-Object System.Net.WebClient).DownloadFile("https://go.microsoft.com/fwlink/?LinkID=623230", "c:\tmp\vs_code.exe" ) | |
if( !(test-path -ea 0 "c:\tmp\vs_code.exe" ) ) { return write-error "Unable to download VS code" } | |
write-host -fore darkcyan " Installing VS Code" | |
C:\tmp\vs_code.exe /silent /norestart | |
while( get-process vs_* ) { write-host -NoNewline "." ; sleep 1 } | |
ReloadPathFromRegistry | |
if( !(get-command -ea 0 code) ) { return write-error "No VS Code in PATH." } | |
} | |
# install wix | |
if (!(get-command -ea 0 heat.exe) ) { | |
write-host -fore cyan "Info: Downloading Wix Toolset." | |
(New-Object System.Net.WebClient).DownloadFile("http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=wix&DownloadId=1587179&FileTime=131118854865270000&Build=21031", "c:\tmp\wix310.exe") | |
if( !(test-path -ea 0 "c:\tmp\wix310.exe" ) ) { return write-error "Unable to download Wix Toolset" } | |
write-host -fore darkcyan " Installing Wix Toolset" | |
C:\tmp\wix310.exe /passive /noreboot | |
while( get-process wix* ) { write-host -NoNewline "." ; sleep 1 } | |
write-host -fore darkcyan " adding Wix Toolset to system PATH." | |
$p = ([System.Environment]::GetEnvironmentVariable( "path", 'Machine')) | |
$p = "$p;${env:ProgramFiles(x86)}\WiX Toolset v3.10\bin" | |
([System.Environment]::SetEnvironmentVariable( "path", $p, 'Machine')) | |
ReloadPathFromRegistry | |
if (!(get-command -ea 0 heat.exe) ) { return "No Wix Toolset in path." } | |
} | |
<# dotnet cli -- 1.0.1 | |
if( !(get-command -ea 0 dotnet) ) { | |
write-host -fore cyan "Info: Downloading Visual Studio Code" | |
(New-Object System.Net.WebClient).DownloadFile("https://go.microsoft.com/fwlink/?LinkId=817245", "c:\tmp\dotnet-cli.exe" ); | |
if( !(test-path -ea 0 "c:\tmp\dotnet-cli.exe" ) ) { return write-error "Unable to download dotnet-cli" } | |
write-host -fore darkcyan " Installing Dotnet-cli" | |
C:\tmp\dotnet-cli.exe /install /passive /noreboot SKIP_VSU_CHECK=1 | |
while( get-process dotnet-* ) { write-host -NoNewline "." ; sleep 1 } | |
ReloadPathFromRegistry | |
if( !(get-command -ea 0 dotnet) ) { return write-error "No dotnet.exe in PATH." } | |
} | |
#> | |
write-host -fore green "You should restart this computer now. (ie, type 'RESTART-COMPUTER' )" | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment