-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
36 lines (30 loc) · 1.08 KB
/
install.ps1
File metadata and controls
36 lines (30 loc) · 1.08 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
[CmdletBinding()]
param (
[string]$GITHUB_USERNAME = 'Ermesx'
)
if (Get-Command -Name winget -ErrorAction SilentlyContinue) {
$params = @(
'--accept-source-agreements'
'--accept-source-agreements'
'--disable-interactivity'
)
# Self upgrade winget
Write-Host '► Upgrading winget' -ForegroundColor Cyan
winget upgrade winget @params| Out-Null
# Required packages to install
$wingets = @('twpayne.chezmoi', 'microsoft.dsc', 'microsoft.powershell')
$wingets | Foreach-Object {
Write-Host "► Installing $_" -ForegroundColor Cyan
winget install $_ @params | Out-Null
}
# Refresh PATH without needing to restart the shell
$userPath = [System.Environment]::GetEnvironmentVariable('PATH', 'User')
$machinePath = [System.Environment]::GetEnvironmentVariable('PATH', 'Machine')
$env:PATH = "$userPath;$machinePath"
# Install chezmoi and apply dotfiles
chezmoi init --apply $GITHUB_USERNAME
}
else {
Write-Host 'winget is not installed. Please install winget first.' -ForegroundColor Red
exit 1
}