-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.ps1
44 lines (34 loc) · 1.21 KB
/
bootstrap.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
<#
.SYNOPSIS
Bootstraps chezmoi on Windows.
.PARAMETER EmalAddress
1Password Email address.
.PARAMETER GithubUsername
Username on Github.
#>
param(
[Parameter(Position = 0)][string]$EmailAddress,
[Parameter(Position = 1)][string]$GithubUsername
)
# TODO - Replace with Ansible script, or something analogous?
$ONEP_VERSION = "v1.12.3"
$ONEP_HOST = "my.1password.ca"
function main {
param ([string]$EmailAddress, [string]$GithubUsername)
# TODO - setup choco?
setupOnePassword -EmailAddress $EmailAddress
# TODO - setup vault
setupChezmoi -GithubUsername $GithubUsername
}
function setupOnePassword {
param ([string]$EmailAddress)
$URI = "https://cache.agilebits.com/dist/1P/op/pkg/$ONEP_VERSION/op_windows_amd64_$ONEP_VERSION.zip"
Invoke-WebRequest -Uri $URI -OutFile $HOME\AppData\Local\Programs\Common\op.exe
Invoke-Expression $(op signin $ONEP_HOST $EmailAddress)
}
function setupChezmoi {
param ([string]$GithubUsername)
'$params = "-BinDir ~/AppData/Local/Programs/Common"', (Invoke-WebRequest https://git.io/chezmoi.ps1).Content | powershell -c -
chezmoi.exe init --apply $GithubUsername
}
main -EmailAddress $EmailAddress -GithubUsername $GithubUsername