-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootstrap.ps1
More file actions
40 lines (35 loc) · 1.66 KB
/
bootstrap.ps1
File metadata and controls
40 lines (35 loc) · 1.66 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
function Dos2Unix {
param([string]$dospath)
return $dospath -replace '\\','/' -replace '^([A-Z]+):/','/$1/'
}
if (([System.Security.Principal.WindowsIdentity]::GetCurrent()).groups -match "S-1-5-32-544") {
# the above line ensures we're running as admin
# try to install scoop + packages
$scoop_install_script_path = "$PSScriptRoot\windows\bootstrap\scoop.ps1"
. "$scoop_install_script_path"
Write-Output "Successfully checked Scoop installation"
# try to install chocolatey + packages
$chocolatey_install_script_path = "$PSScriptRoot\windows\bootstrap\choco.ps1"
. "$chocolatey_install_script_path"
Write-Output "Successfully checked Chocolatey installation"
# Enable WSL2 support
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2
# start git-bash / mysis (if installed)
$bash_path = "$env:userprofile\scoop\apps\git\current\bin\sh.exe"
$dotfiles_bootstrap_path = "$PSScriptRoot\bootstrap"
Write-Output "Now running bootstrap script in bash..."
if (Test-Path $bash_path) {
& $bash_path --login $dotfiles_bootstrap_path
Write-Output "Bootstrap script run successfully"
Write-Output "Opening Git-Bash for you ..."
# afterwards, start git-bash / mysis will automatically open
$git_bash_path = "$env:userprofile\scoop\apps\git\current\git-bash.exe"
& $git_bash_path
} else {
Write-Error "Git-Bash has apparently not been installed correctly. Please check"
}
} else {
Write-Warning "This Script required Admin privileges. Please run your PowerShell as Admin!"
}