-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.ps1
More file actions
52 lines (42 loc) · 1.44 KB
/
Copy pathbootstrap.ps1
File metadata and controls
52 lines (42 loc) · 1.44 KB
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
[CmdletBinding(SupportsShouldProcess)]
param(
[string]$Destination = (Join-Path $env:TEMP 'setup-bootstrap'),
[switch]$SkipRecommendedPackages,
[switch]$SkipClaudeCode,
[switch]$SkipProfileBootstrap
)
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
$repoBaseUri = 'https://raw.githubusercontent.com/bbobrian/setup/main'
$scriptNames = @(
'setup.ps1'
'setup-profile.ps1'
)
if (-not (Test-Path $Destination)) {
if ($PSCmdlet.ShouldProcess($Destination, 'Create bootstrap directory')) {
New-Item -ItemType Directory -Path $Destination -Force | Out-Null
}
}
foreach ($scriptName in $scriptNames) {
$targetPath = Join-Path $Destination $scriptName
$sourceUri = "$repoBaseUri/$scriptName"
if ($PSCmdlet.ShouldProcess($sourceUri, "Download $scriptName")) {
Write-Host "Downloading $scriptName..." -ForegroundColor Yellow
Invoke-WebRequest -Uri $sourceUri -OutFile $targetPath
}
}
$setupScriptPath = Join-Path $Destination 'setup.ps1'
$setupArguments = @()
if ($SkipRecommendedPackages) {
$setupArguments += '-SkipRecommendedPackages'
}
if ($SkipClaudeCode) {
$setupArguments += '-SkipClaudeCode'
}
if ($SkipProfileBootstrap) {
$setupArguments += '-SkipProfileBootstrap'
}
if ($PSCmdlet.ShouldProcess($setupScriptPath, 'Run setup script')) {
Write-Host "Running $setupScriptPath..." -ForegroundColor Cyan
& $setupScriptPath @setupArguments -WhatIf:$WhatIfPreference
}