forked from JoshMcCullough/SVG
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbootstrapper.ps1
More file actions
38 lines (33 loc) · 1.43 KB
/
bootstrapper.ps1
File metadata and controls
38 lines (33 loc) · 1.43 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
$aup = [System.Environment]::ExpandEnvironmentVariables("%allusersprofile%")
$arguments = "& '" + $myinvocation.mycommand.definition + "'"
function ensureAdministrativeRights(){
# run as administrator
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
Start-Process powershell -Verb runAs -ArgumentList $arguments
Break
}
}
# ensure chocolatey is installed
$chocolateyInstalled = Test-Path "$aup\chocolatey" -pathType container
if($chocolateyInstalled -eq $false){
$policy = Get-ExecutionPolicy
if($policy -ne "Unrestricted" -and $policy -ne "RemoteSigned"){
throw "Please set your executionpolicy to RemoteSigned or Unrestricted"
}
ensureAdministrativeRights
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
}
# ensure psake is installed
$psakeInstalled = Test-Path "$aup\chocolatey\lib\psake" -pathType container
if($psakeInstalled -eq $false){
ensureAdministrativeRights
choco install psake
# after installing psake - we need to restart the console in order to have "psake" available as command (Path variable is loaded)
Start-Process powershell -Verb runAs -ArgumentList $arguments
#Set-Alias psake "$aup\chocolatey\lib\psake\tools\psake.ps1" -Scope Global -Verbose
}
# run the default build
psake
# wait for any user input
Read-Host