-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.ps1
32 lines (27 loc) · 1.24 KB
/
install.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
32
# Installed for so-posh.
# A script that install and deploys powershell profile.
$global:PROOT = [System.IO.Path]::GetDirectoryName($PROFILE)
$SO_POSH_PROFILE_TEMPLATE_PATH = Join-Path $PSScriptRoot "profile/templates/Microsoft.PowerShell_profile.ps1"
Write-Host "Installing so-posh..."
Write-Host "> Installing modules..."
Write-Host "> Installing pscx..."
Install-Module pscx -Scope CurrentUser -AllowClobber
Write-Host "> Installing Jump.Location..."
Install-Module Jump.Location -Scope CurrentUser -AllowClobber
Write-Host "> Installing posh-git..."
Install-Module posh-git -Scope CurrentUser -AllowClobber
Write-Host "> Loading so-posh..."
Import-Module so-posh
# 3. If no profile exists create one. Create package if it does not exist yet.
Write-Host "> Creating a PowerShell profile..."
if ([System.IO.File]::Exists($PROFILE)) {
$overwrite = $Host.UI.PromptForChoice('', 'You already have a PowerShell profile. Do you want to overwrite it?', @('&Yes', '&No'), 0)
if ($overwrite -eq 0) {
Copy-Item $SO_POSH_PROFILE_TEMPLATE_PATH $PROFILE
}
} else {
Copy-Item $SO_POSH_PROFILE_TEMPLATE_PATH $PROFILE
}
Write-Host "> Creating a home-profile folder for dotfiles..."
New-SoPoshModule 'home-profile'
Write-Host "Installed so-posh" -ForegroundColor Green