refactor: finish moving ssh-* scripts to own installers
[webi-installers/.git] / nerdfont / install.ps1
index 9157d1f0947804a8469438cb35cafc3f652fc812..398dafde4d5df20126de31737a044105d3b195fc 100644 (file)
@@ -6,9 +6,7 @@ $my_fontdir = "$Env:UserProfile\AppData\Local\Microsoft\Windows\Fonts"
 New-Item -Path "$my_fontdir" -ItemType Directory -Force | out-null
 IF (!(Test-Path -Path "$my_fontdir\$my_nerdfont_otf"))
 {
-
-    & curl.exe -fsSLo "$my_nerdfont_otf" 'https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/DroidSansMono/complete
-/Droid%20Sans%20Mono%20Nerd%20Font%20Complete%20Windows%20Compatible.otf'
+    & curl.exe -fsSLo "$my_nerdfont_otf" 'https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/DroidSansMono/complete/Droid%20Sans%20Mono%20Nerd%20Font%20Complete%20Windows%20Compatible.otf'
     & move "$my_nerdfont_otf" "$my_fontdir"
 }
 
@@ -18,7 +16,7 @@ pushd "$my_fontdir"
 $regFontPath = "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts"
 $fontRegistryPath = "HKCU:$regFontPath"
 $fontFiles = Get-ChildItem -Recurse -Include *.ttf, *.otf
-$null = foreach($font in $fontFiles) {
+foreach($font in $fontFiles) {
     # See https://github.com/PPOSHGROUP/PPoShTools/blob/master/PPoShTools/Public/FileSystem/Add-Font.ps1#L80
     Add-Type -AssemblyName System.Drawing
     $objFontCollection = New-Object System.Drawing.Text.PrivateFontCollection
@@ -27,9 +25,12 @@ $null = foreach($font in $fontFiles) {
 
     $regTest = Get-ItemProperty -Path $fontRegistryPath -Name "*$FontName*" -ErrorAction SilentlyContinue
     if (-not ($regTest)) {
-        New-ItemProperty -Name $FontName -Path $fontRegistryPath -PropertyType string -Value $font.FullName
-        Write-Output "Registering font {$($font.Name)} in registry with name {$FontName}"
+        New-ItemProperty -Name $FontName -Path $fontRegistryPath -PropertyType string -Value $font.Name
+        Write-Output "Registered font {$($font.Name)} in Current User registry as {$FontName}"
     }
+    echo "Installed $my_nerdfont_otf to $my_fontdir"
+    # because adding to the registry alone doesn't actually take
+    & start $font.FullName
+    echo ""
+    echo "IMPORTANT: Click 'Install' to complete installation"
 }
-
-echo "Installed $my_nerdfont_otf to $my_fontdir"