-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.ps1
114 lines (104 loc) · 3.73 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
using namespace System.Security.Principal
# Self-elevate
if (!([WindowsPrincipal] [WindowsIdentity]::GetCurrent()).IsInRole([WindowsBuiltInRole]::Administrator)) {
Start-Process `
-FilePath (Get-Process -Id $PID).Path `
-ArgumentList @('-NoProfile', '-File', "`"$PSCommandPath`"") `
-Verb RunAs `
-Wait
return
}
Write-Output '- Installing package provider...'
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Write-Output '- Installing Powershell modules...'
Install-Module -Name Az.Accounts -RequiredVersion 2.9.1 -Force
Install-Module -Name Az.Resources -RequiredVersion 6.1.0 -Force
Install-Module -Name Az.Tools.Predictor -RequiredVersion 1.0.1 -Force
Install-Module -Name PowerShellGet -RequiredVersion 2.2.5 -Force
Install-Module -Name PsIni -RequiredVersion 3.1.2 -Force
Install-Module -Name PSReadLine -RequiredVersion 2.2.6 -Force
Install-Module -Name Recycle -RequiredVersion 1.3.1 -Force
Install-Module -Name Terminal-Icons -RequiredVersion 0.11.0 -Force
Install-Module -Name z -RequiredVersion 1.1.13 -Force -AllowClobber
Import-Module $PSScriptRoot/powershell/base -Force
# TODO: create *.custom.* files (from *.custom.sample.*) if they don't already exist
Write-Output '- Creating symlinks...'
& $PSScriptRoot/firefox/install
@(
@{
Target = './.omnisharp'
Source = '~/.omnisharp'
}
@{
Target = './azuredatastudio/settings.json'
Source = "$env:APPDATA/azuredatastudio/User/settings.json"
}
@{
Target = './config'
Source = '~/.config'
}
@{
Target = './espanso'
Source = '~/scoop/persist/espanso/.espanso'
}
@{
Target = './powershell/profile.ps1'
Source = $PROFILE.CurrentUserCurrentHost
}
@{
Target = './terminal/settings.json'
Source = @(
"~/scoop/apps/windows-terminal/current/settings/settings.json"
"~/scoop/apps/windows-terminal-preview/current/settings/settings.json"
"$env:LOCALAPPDATA/Packages/Microsoft.WindowsTerminal_8wekyb3d8bbwe/LocalState/settings.json"
"$env:LOCALAPPDATA/Packages/Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe/LocalState/settings.json"
)
}
@{
Target = './vscode/keybindings.json'
Source = @(
"~/scoop/persist/vscode/data/user-data/User/keybindings.json"
"~/scoop/persist/vscode-insiders/data/user-data/User/keybindings.json"
)
}
@{
Target = './vscode/settings.json'
Source = @(
"~/scoop/persist/vscode/data/user-data/User/settings.json"
"~/scoop/persist/vscode-insiders/data/user-data/User/settings.json"
)
}
@{
Target = './vscode/tasks.json'
Source = @(
"~/scoop/persist/vscode/data/user-data/User/tasks.json"
"~/scoop/persist/vscode-insiders/data/user-data/User/tasks.json"
)
}
@{
Target = './wsl/.wslconfig'
Source = '~/.wslconfig'
}
) | ForEach-Object {
New-Link `
-Type SymbolicLink `
-Target "$PSScriptRoot/$($_.Target)" `
-Source $_.Source |
Out-Null
}
# Create AutoHotkey scheduled task
Write-Output '- Creating scheduled tasks...'
& './ahk/install' | Out-Null
Write-Output '- Done.'
Write-Output ''
Write-Output 'Close PowerShell and reopen it for changes to take effect.'
Write-Output ''
# Enable long paths (Windows 10 version 1607 and Later)
# https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=powershell#enable-long-paths-in-windows-10-version-1607-and-later
New-ItemProperty `
-Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' `
-Name 'LongPathsEnabled' `
-Value 1 `
-PropertyType DWORD `
-Force
pause