-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.ps1
131 lines (119 loc) · 3.97 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
param(
[Parameter(HelpMessage="Automatically install work applications")]
[switch]$w = $False,
[Parameter(HelpMessage="Automatically install personal applications")]
[switch]$h = $False,
[Parameter(HelpMessage="Skip all package installation")]
[switch]$n = $False
)
function Install-Dir {
param ([string]$dir, [string]$path)
echo "Installing $dir to $path..."
Get-ChildItem "$PSScriptRoot\$dir" | Foreach-Object {
$orig = $_.FullName
$file = $_.Name
$dest = "$path\$file"
if (-not (Test-Path -Path $dest)) {
New-Item -ItemType SymbolicLink -Target $orig -Path $dest -ErrorAction Stop
}
}
}
function Install-File {
param ([string]$file, [string]$dest)
echo "Installing $file to $dest..."
$props = Get-ChildItem "$PSScriptRoot\$file"
$orig = $props.FullName
if (-not (Test-Path -Path $dest)) {
$destPath = [System.IO.Path]::GetDirectoryName($dest)
if (-not (Test-Path -Path $destPath)) {
New-Item $destPath -ItemType Directory
}
New-Item -ItemType SymbolicLink -Target $orig -Path $dest -ErrorAction Stop
}
}
function Install-WingetPackages {
param ([string[]]$packages)
$packages.ForEach({
winget list -e --accept-source-agreements --id $_
if ($?) {
Write-Host "$_ already installed, skipping..."
} else {
Write-Host "$_ not installed, installing..."
winget install -e -s winget --accept-package-agreements --accept-source-agreements --id $_
}
})
}
# Install packages
if (-not $n) {
Write-Host 'Installing common packages...'
Install-WingetPackages (
'7zip.7zip',
'AgileBits.1Password',
'Armin2208.WindowsAutoNightMode',
'AutoHotkey.AutoHotkey',
'cURL.cURL',
'dotPDNLLC.paintdotnet',
'Git.Git',
'GitHub.cli',
'Google.Chrome',
'JanDeDobbeleer.OhMyPosh',
'Lexikos.AutoHotkey',
'Microsoft.PowerShell.Preview',
'Microsoft.PowerToys',
'Microsoft.VisualStudioCode',
'Microsoft.WindowsTerminal',
'Mozilla.Firefox',
'Neovide.Neovide',
'Neovim.Neovim.Nightly',
'Obsidian.Obsidian',
'Python.Python.3.12',
'Spotify.Spotify',
'Yarn.Yarn',
'Zoom.Zoom'
)
if ($h -or ((-not $w) -and ($(Read-Host -Prompt 'Install home packages? (y/N)') -eq 'y'))) {
Write-Host 'Installing home packages...'
Install-WingetPackages (
'Discord.Discord',
'Foxit.FoxitReader',
'Mojang.MinecraftLauncher',
'OpenWhisperSystems.Signal',
'Telegram.TelegramDesktop',
'Ultimaker.Cura',
'Valve.Steam',
'VideoLAN.VLC'
)
}
if ($w -or ((-not $h) -and ($(Read-Host -Prompt 'Install work packages? (y/N)') -eq 'y'))) {
Write-Host 'Installing work packages...'
Install-WingetPackages (
'ApacheFriends.Xampp.8.1',
'Asana.Asana',
'Figma.Figma',
'Hashicorp.Vagrant',
'Loom.Loom',
'OpenVPNTechnologies.OpenVPNConnect',
'Oracle.VirtualBox',
'SlackTechnologies.Slack'
)
}
}
Write-Host 'Upgrading installed packages...'
winget upgrade -s winget --accept-package-agreements --accept-source-agreements --all
# Install features
Install-Dir -Dir 'configs' -Path "$HOME\.config"
Install-Dir -Dir 'dotfiles' -Path "$HOME"
Install-File 'windows\profile.ps1' $PROFILE
Install-File 'windows\spaceshipfixed.omp.json' "$($env:LOCALAPPDATA)\Programs\oh-my-posh\themes\spaceshipfixed.omp.json"
Install-File 'windows\layers.ahk' 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\layers.ahk'
# Install this via symlink instead of its native copier.
Install-File 'windows\windowsTerminal_themeToggler.ps1' "$($env:LOCALAPPDATA)\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\windowsTerminal_themeToggler.ps1"
windows\windowsTerminal_themeToggler.ps1
$firefoxprofiles = "$($env:APPDATA)\Mozilla\Firefox\Profiles"
Get-ChildItem "$firefoxprofiles" | Foreach-Object {
$profile = $_.FullName
$dest = "$profile\chrome"
New-Item -Type Directory $dest -ErrorAction SilentlyContinue
Install-Dir -Dir 'firefox' -Path "$dest"
}
echo 'Done!'