diff --git a/config.ps1 b/config.ps1 index dfe6c86..478ed9c 100644 --- a/config.ps1 +++ b/config.ps1 @@ -59,7 +59,7 @@ function InstallSoftware { } } else { - if (CheckForLink(~\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json) -eq $False) { + if (CheckForLink("~\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json") -eq $False) { Write-Host "Lege Winget config an." -ForegroundColor Blue Remove-Item "~\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json" try { @@ -139,7 +139,7 @@ function InstallSoftware { } # Windows Terminal Settings Write-Host "Richte Windows Terminal config ein..." -ForegroundColor Blue - if (CheckForLink(~\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json) -eq $False) { + if (CheckForLink("~\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json") -eq $False) { Try { Remove-Item "~\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" ; New-Item -Path "~\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" -ItemType SymbolicLink -Value "~/.winconfig/configs/terminal/settings.json" | Out-Null Write-Host "Windows Terminal config erfolgreich eingerichtet" -ForegroundColor Green @@ -177,51 +177,47 @@ function InstallSoftware { Write-Host "Probleme beim installieren von Winfetch" -ForegroundColor Red } } - if (CheckForLink(~/.config/winfetch/config.ps1) -eq $False) { + if (CheckForLink("~/.config/winfetch/config.ps1") -eq $False) { Remove-Item "~/.config/winfetch/config.ps1" New-Item -Path "~/.config/winfetch/config.ps1" -ItemType SymbolicLink -Value "~/.winconfig/configs/winfetch/config.ps1" | Out-Null } # Powershell Profile Datei erzeugen Write-Host "Löschen des default Powershell profiles..." -ForegroundColor Blue if ((Test-Path "~/Documents/PowerShell/profile.ps1" -PathType Leaf) -eq $True) { - if (CheckForLink(~/Documents/PowerShell/profile.ps1) -eq $False) { - Remove-Item -Force "~/Documents/PowerShell/profile.ps1" - Write-Host "Powershell config ~/Documents/PowerShell/profile.ps1 erfolgreich gelöscht." -ForegroundColor Green - Try { - New-Item -Path "~/Documents/PowerShell/profile.ps1" -ItemType SymbolicLink -Value "~/.winconfig/profile.ps1" | Out-Null - Write-Host "Powershell config ~/Documents/PowerShell/profile.ps1 erfolgreich verlinkt." - } - Catch { - Write-Host "Probleme beim verlinken der Powershell config ~/Documents/PowerShell/profile.ps1 " -ForegroundColor Red - } - } + mkdir "~/Documents/PowerShell/" + Remove-Item -Force "~/Documents/PowerShell/profile.ps1" + Write-Host "Powershell config ~/Documents/PowerShell/profile.ps1 erfolgreich gelöscht." -ForegroundColor Green + } + Try { + New-Item -Path "~/Documents/PowerShell/profile.ps1" -ItemType SymbolicLink -Value "~/.winconfig/profile.ps1" | Out-Null + mkdir "~/Documents/PowerShell/" + Write-Host "Powershell config ~/Documents/PowerShell/profile.ps1 erfolgreich verlinkt." + } + Catch { + Write-Host "Probleme beim verlinken der Powershell config ~/Documents/PowerShell/profile.ps1 " -ForegroundColor Red } if ((Test-Path "~/Documents/WindowsPowerShell/profile.ps1" -PathType Leaf) -eq $True) { - if (CheckForLink(~/Documents/WindowsPowerShell/profile.ps1) -eq $False) { - Remove-Item -Force "~/Documents/WindowsPowerShell/profile.ps1" - Write-Host "Powershell config ~/Documents/WindowsPowerShell/profile.ps1 erfolgreich gelöscht." -ForegroundColor Green - Try { - New-Item -Path "~/Documents/WindowsPowerShell/profile.ps1" -ItemType SymbolicLink -Value "~/.winconfig/profile.ps1" | Out-Null - Write-Host "Powershell config ~/Documents/WindowsPowerShell/profile.ps1 erfolgreich verlinkt." - } - Catch { - Write-Host "Probleme beim verlinken der Powershell config ~/Documents/WindowsPowerShell/profile.ps1" -ForegroundColor Red - } - } + Remove-Item -Force "~/Documents/WindowsPowerShell/profile.ps1" + Write-Host "Powershell config ~/Documents/WindowsPowerShell/profile.ps1 erfolgreich gelöscht." -ForegroundColor Green } + Try { + New-Item -Path "~/Documents/WindowsPowerShell/profile.ps1" -ItemType SymbolicLink -Value "~/.winconfig/profile.ps1" | Out-Null + Write-Host "Powershell config ~/Documents/WindowsPowerShell/profile.ps1 erfolgreich verlinkt." + } + Catch { + Write-Host "Probleme beim verlinken der Powershell config ~/Documents/WindowsPowerShell/profile.ps1" -ForegroundColor Red + } if ((Test-Path "~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1" -PathType Leaf) -eq $True) { - if (CheckForLink("~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1") -eq $True) { - Remove-Item -Force "~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1" - Write-Host "Powershell ~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1 config erfolgreich gelöscht." -ForegroundColor Green - Try { - New-Item -Path "~\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" -ItemType SymbolicLink -Value "~/.winconfig/profile.ps1" | Out-Null - Write-Host "Powershell config ~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1 erfolgreich verlinkt." - } - Catch { - Write-Host "Probleme beim verlinken der Powershell config ~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1 ." -ForegroundColor Red - } - } - } + Remove-Item -Force "~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1" + Write-Host "Powershell ~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1 config erfolgreich gelöscht." -ForegroundColor Green + } + Try { + New-Item -Path "~\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" -ItemType SymbolicLink -Value "~/.winconfig/profile.ps1" | Out-Null + Write-Host "Powershell config ~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1 erfolgreich verlinkt." + } + Catch { + Write-Host "Probleme beim verlinken der Powershell config ~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1 ." -ForegroundColor Red + } # Autohotkey in Startup Write-Host "Verlinke AutoHokey Scripts ..." -ForegroundColor Blue $sourceDir = "~\.winconfig\configs\autohotkey" @@ -230,7 +226,22 @@ function InstallSoftware { $linkPath = Join-Path $targetDir $_.Name New-Item -ItemType SymbolicLink -Path $linkPath -Target $_.FullName -ErrorAction SilentlyContinue | Out-Null } - Write-Host "AutoHotkey Scripts erfolgreich installiert." -ForegroundColor Green + Write-Host "AutoHotkey Scripts erfolgreich installiert." -ForegroundColor Green + # Powershell Modul für PSReadline (oh-my-posh abhängigkeit) + if (Get-Module -ListAvailable -Name PSReadLine ) { + Write-Hoste "Windows Update Powershell Modul ist bereits installiert." -ForegroundColor Blue + } + else { + + Write-Host "Beginne mit der Insallation des Powershell Update Modul..." -ForegroundColor Blue + Try { + Install-Module Install-Module PSReadLine -Force + Write-Host "Powershell update Modul erfolgreich installiert..." -ForegroundColor Green + } + Catch { + Write-Host "Fehler beim installieren des Powershell update Modul." -ForegroundColor Red + } + } # Powershell Modul für Updates if (Get-Module -ListAvailable -Name PSWindowsUpdate) { Write-Hoste "Windows Update Powershell Modul ist bereits installiert." -ForegroundColor Blue