-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsetup-windows.ps1
161 lines (133 loc) · 5.19 KB
/
setup-windows.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# This script should be run in an administrative shell
# It installs software using combination of two package managers: Chocolately and Scoop
# @see https://gist.github.com/mkropat/c1226e0cc2ca941b23a9
function Add-EnvPath {
param(
[Parameter(Mandatory=$true)]
[string] $Path,
[ValidateSet('Machine', 'User', 'Session')]
[string] $Container = 'Session'
)
if ($Container -ne 'Session') {
$containerMapping = @{
Machine = [EnvironmentVariableTarget]::Machine
User = [EnvironmentVariableTarget]::User
}
$containerType = $containerMapping[$Container]
$persistedPaths = [Environment]::GetEnvironmentVariable('Path', $containerType) -split ';'
if ($persistedPaths -notcontains $Path) {
$persistedPaths = $persistedPaths + $Path | where { $_ }
[Environment]::SetEnvironmentVariable('Path', $persistedPaths -join ';', $containerType)
}
}
$envPaths = $env:Path -split ';'
if ($envPaths -notcontains $Path) {
$envPaths = $envPaths + $Path | where { $_ }
$env:Path = $envPaths -join ';'
}
}
function Remove-EnvPath {
param(
[Parameter(Mandatory=$true)]
[string] $Path,
[ValidateSet('Machine', 'User', 'Session')]
[string] $Container = 'Session'
)
if ($Container -ne 'Session') {
$containerMapping = @{
Machine = [EnvironmentVariableTarget]::Machine
User = [EnvironmentVariableTarget]::User
}
$containerType = $containerMapping[$Container]
$persistedPaths = [Environment]::GetEnvironmentVariable('Path', $containerType) -split ';'
if ($persistedPaths -contains $Path) {
$persistedPaths = $persistedPaths | where { $_ -and $_ -ne $Path }
[Environment]::SetEnvironmentVariable('Path', $persistedPaths -join ';', $containerType)
}
}
$envPaths = $env:Path -split ';'
if ($envPaths -contains $Path) {
$envPaths = $envPaths | where { $_ -and $_ -ne $Path }
$env:Path = $envPaths -join ';'
}
}
function Get-EnvPath {
param(
[Parameter(Mandatory=$true)]
[ValidateSet('Machine', 'User')]
[string] $Container
)
$containerMapping = @{
Machine = [EnvironmentVariableTarget]::Machine
User = [EnvironmentVariableTarget]::User
}
$containerType = $containerMapping[$Container]
[Environment]::GetEnvironmentVariable('Path', $containerType) -split ';' |
where { $_ }
}
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')
#####################
# BILL OF MATERIALS
#####################
scoop install git
scoop bucket add extras
# 7Zip
scoop install 7zip
# Dev Tools
scoop install aria2
choco install -y bosh-cli
scoop install curl
scoop install vscode
scoop install aliyun
scoop install azure-cli
choco install -y aws-iam-authenticator
scoop install aws
choco install -y cloudfoundry-cli
scoop install doctl
scoop install gcloud
choco install -y gnupg
scoop install graphviz
choco install -y libressl
choco install -y minio-client
choco install -y openssl
scoop install terraform
choco install -y terraform-docs
scoop install tflint
choco install -y httpie -source python
choco install -y keybase
choco install -y kind
scoop install kubectl
scoop install k9s
scoop install helm
scoop install helmfile
choco install -y mkcert
scoop install octant
scoop tar install
choco install -y tektoncd-cli
choco install -y vendir
choco install -y ytt
choco install -y kapp
choco install -y kbld
choco install -y imgpkg
Set-Variable TF_K14S_PLUGIN_VERSION 0.6.0
md $HOME/.terraform.d/plugins/registry.terraform.io/hashicorp/k14s/$TF_K14S_PLUGIN_VERSION -ea 0
curl -LO "https://github.com/k14s/terraform-provider-k14s/releases/download/v$TF_K14S_PLUGIN_VERSION/terraform-provider-k14s-binaries.tgz"
tar xzvf terraform-provider-k14s-binaries.tgz -C $HOME/.terraform.d/plugins/registry.terraform.io/hashicorp/k14s/$TF_K14S_PLUGIN_VERSION
Remove-Item terraform-provider-k14s-binaries.tgz
md $HOME/.apps/bin -ea 0
cd $HOME/.apps/bin
Set-Variable PIVNET_VERSION 3.0.1
curl -LO "https://github.com/pivotal-cf/pivnet-cli/releases/download/v$PIVNET_VERSION/pivnet-windows-amd64-$PIVNET_VERSION"
Rename-Item -Path "pivnet-linux-amd64-$PIVNET_VERSION.exe" -NewName "pivnet.exe"
Set-Variable ARGOCD_VERSION 2.10.0
curl -LO "https://github.com/argoproj/argo-cd/releases/download/v$ARGOCD_VERSION/argocd-windows-amd64.exe"
Rename-Item -Path "argocd-windows-amd64.exe" -NewName "argocd.exe"
Set-Variable KREW_VERSION 0.3.4
curl -LO "https://github.com/kubernetes-sigs/krew/releases/download/v$KREW_VERSION/krew.exe"
curl -LO "https://github.com/kubernetes-sigs/krew/releases/download/v$KREW_VERSION/krew.yaml"
krew install --manifest=krew.yaml
Set-Variable TMC_VERSION 0.2.0-ba47223d
curl -LO "https://vmware.bintray.com/tmc/$TMC_VERSION/windows/x64/tmc.exe"
Add-EnvPath -Path "$HOME/.apps/bin" -Container "Machine"