Skip to content

Instantly share code, notes, and snippets.

@SuperPaxxs
Last active January 23, 2020 08:17
Show Gist options
  • Save SuperPaxxs/a8b59683e1a05a09e3b6984c1a625133 to your computer and use it in GitHub Desktop.
Save SuperPaxxs/a8b59683e1a05a09e3b6984c1a625133 to your computer and use it in GitHub Desktop.
#Requires -RunAsAdministrator
#Requires -Version 5
if (($PSVersionTable.PSVersion.Major) -lt 5) {
Write-Output "PowerShell 5 or later is required to run bootstrap."
Write-Output "Upgrade PowerShell: https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell"
break
}
# show notification to change execution policy:
$allowedExecutionPolicy = @('Unrestricted', 'RemoteSigned', 'ByPass')
if ((Get-ExecutionPolicy).ToString() -notin $allowedExecutionPolicy) {
Write-Output "PowerShell requires an execution policy in [$($allowedExecutionPolicy -join ", ")] to run bootstrap."
Write-Output "For example, to set the execution policy to 'RemoteSigned' please run :"
Write-Output "'Set-ExecutionPolicy RemoteSigned -scope CurrentUser'"
break
}
if ([System.Enum]::GetNames([System.Net.SecurityProtocolType]) -notcontains 'Tls12') {
Write-Output "paxos` dotfiles requires at least .NET Framework 4.5"
Write-Output "Please download and install it first:"
Write-Output "https://www.microsoft.com/net/download"
break
}
Write-Host ":: " -ForegroundColor DarkBlue -NoNewline
Write-Host "Load bootstrap script" -ForegroundColor DarkCyan
$bootstrap_url = Read-Host "input url:"
$bootstrap_dir = "$($env:HOMEDRIVE)$($env:HOMEPATH)"
Write-Output "Downloading..."
(New-Object System.Net.WebClient).DownloadFile($bootstrap_url,"$bootstrap_dir\pxbootstrap.ps1")
$level = Read-Host "Select level (Minimal/Basic/Full)"
if (Test-Path "$bootstrap_dir\pxbootstrap.ps1") {
. "$bootstrap_dir\pxbootstrap.ps1" $level
Write-Output "Remove bootstrap..."
Remove-Item "$bootstrap_dir\pxbootstrap.ps1" -Force -ErrorAction Continue
} else {
Write-Host "ERROR: Unable to load script" -ForegroundColor Red
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment