-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathSetup.ps1
31 lines (26 loc) · 865 Bytes
/
Setup.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
#Requires -RunAsAdministrator
#Requires -PSEdition Core
#Requires -Version 7.2
param([switch]$RunNow)
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version 3.0
$script:rootDir = Resolve-Path (Join-Path $PSScriptRoot ..)
$script:profileDir = Join-Path $rootDir Profile
. "$profileDir/Common.ps1"
. "$profileDir/Functions.ps1"
$script:setupControl = Join-Path $PSScriptRoot .setupran
$script:setupDir = $PSScriptRoot
function RunSetup {
if (!(Test-Path $setupControl)) {
New-Item -ItemType File "$setupControl" | Out-Null
if ($IsWindows) { (Get-Item $setupControl).Attributes += 'Hidden' }
}
& "$setupDir/InstallTools.ps1"
if ($IsWindows) {
& "$setupDir/Setup-Windows.ps1"
}
}
$script:isDotSourced = $MyInvocation.InvocationName -eq '.' -or $MyInvocation.Line -eq ''
if (!$isDotSourced -or $RunNow) {
RunSetup
}