forked from mttaggart/shell-setup
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathquickstart.ps1
More file actions
50 lines (43 loc) · 1.42 KB
/
quickstart.ps1
File metadata and controls
50 lines (43 loc) · 1.42 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
$ErrorActionPreference = 'Stop'
$QuickstartSourceUrl = 'https://raw.githubusercontent.com/HuskyHacks/shell-setup/main/quickstart.ps1'
if ($PSVersionTable.PSVersion.Major -lt 7) {
$pwsh = Get-Command pwsh -ErrorAction SilentlyContinue
if (-not $pwsh) {
Write-Error @'
PowerShell 7 is required (setup.ps1 uses #Requires -Version 7). Install it, then run again:
winget install Microsoft.PowerShell
Then open PowerShell 7 (pwsh) and re-run the quickstart one-liner, or run: pwsh -File .\quickstart.ps1
'@
exit 1
}
$path = $MyInvocation.MyCommand.Path
if ($path) {
& $pwsh.Path -NoProfile -ExecutionPolicy Bypass -File $path @args
}
else {
$cmd = "& { irm '$QuickstartSourceUrl' | iex }"
& $pwsh.Path -NoProfile -ExecutionPolicy Bypass -Command $cmd
}
exit $LASTEXITCODE
}
function Main {
Write-Host '[+] One mattlab, coming right up!'
$repo = Join-Path $HOME 'shell-setup'
if (Test-Path -LiteralPath $repo) {
Write-Host '[+] shell-setup directory already exists. Skipping clone...'
Push-Location -LiteralPath $repo
}
else {
Write-Host '[+] Cloning shell-setup...'
git clone https://github.com/HuskyHacks/shell-setup.git $repo
Push-Location -LiteralPath $repo
}
try {
Write-Host '[+] Running setup.ps1...'
& (Join-Path $repo 'setup.ps1')
}
finally {
Pop-Location
}
}
Main