-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.ps1
77 lines (67 loc) · 2.05 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
[CmdletBinding()]
param (
# Skip Installing Powershell Core
[Parameter()]
[switch]
$skipPowershellCore,
# Skip Installing Terminal-Icons
[Parameter()]
[switch]
$skipTerminalIcons,
# Skip Installing PSReadLine
[Parameter()]
[switch]
$skipPSReadLine,
# Skip Installing Oh My Posh
[Parameter()]
[switch]
$skipOhMyPosh,
# Skip Installing Nerd Font
[Parameter()]
[switch]
$skipNerdFont
)
if (!$skipPowershellCore) {
winget install --id Microsoft.Powershell --source winget
}
if (!$skipTerminalIcons) {
echo "Installing Icons"
Install-Module -Name Terminal-Icons -Repository PSGallery
}
if (!$skipPSReadLine) {
if($PSVersionTable.PSEdition -ne "Core") {
echo "Installing PowerShellGet"
Install-Module -Name PowerShellGet -Force
}
echo "Installing PSReadLine"
Install-Module PSReadLine -AllowPrerelease -AllowClobber -Force
}
if (!$skipOhMyPosh) {
echo "Installing Oh My Posh"
winget install JanDeDobbeleer.OhMyPosh
}
if (!$skipNerdFont) {
echo "Installing Nerd fonts"
$dloadLink = "https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/FiraCode.zip"
$tempFolder = "$env:temp\PowerShell-Setup"
$tempFontZip = "$tempFolder\fonts.zip"
md -Force "$tempFolder\fonts"
echo "Downloading fonts"
Invoke-WebRequest -Uri $dloadLink -OutFile $tempFontZip
Expand-Archive -Path $tempFontZip -DestinationPath "$tempFolder\fonts"
echo "Installing each ttf font"
$fonts = (New-Object -ComObject Shell.Application).Namespace(0x14)
foreach ($file in gci "$tempFolder\fonts\*.ttf")
{
$fileName = $file.Name
if (-not(Test-Path -Path "C:\Windows\fonts\$fileName" )) {
echo $fileName
dir $file | %{ $fonts.CopyHere($_.fullname) }
}
}
cp "$tempFolder\fonts\*.ttf" C:\windows\fonts\
}
echo "Copying PowerShell profile"
Copy-Item ".\Microsoft.PowerShell_profile.ps1" -Destination $profile
echo "Copying Oh My Posh theme"
Copy-Item ".\blueier.omp.json" -Destination $HOME