From 6e5882a2fd02d30206ab9ca8aa5847b8ea09196c Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Wed, 12 Aug 2026 09:19:03 +0200 Subject: Normalize line endings --- bootstrap-win/git.ps1 | 150 +++++++++++++++++++++++++------------------------- 1 file changed, 75 insertions(+), 75 deletions(-) (limited to 'bootstrap-win/git.ps1') diff --git a/bootstrap-win/git.ps1 b/bootstrap-win/git.ps1 index 6accba4..8d63338 100644 --- a/bootstrap-win/git.ps1 +++ b/bootstrap-win/git.ps1 @@ -1,75 +1,75 @@ -#Requires -Version 5.1 -<# - Installiert Git und delta (Pager fuer git/config) per winget. - - Aufruf (keine Admin-Rechte noetig): - .\bootstrap-win\git.ps1 -#> - -$ErrorActionPreference = "Stop" -$script:Failures = @() - -function Write-Ok($msg) { - Write-Host "OK $msg" -ForegroundColor Green -} - -function Write-Step($msg) { - Write-Host "==> $msg" -ForegroundColor Cyan -} - -function Write-Skip($msg) { - Write-Host "- $msg bereits vorhanden" -ForegroundColor DarkGray -} - -function Write-Warn($msg) { - Write-Host "! $msg" -ForegroundColor Yellow - $script:Failures += $msg -} - -function Test-CommandExists([string]$Name) { - return [bool](Get-Command $Name -ErrorAction SilentlyContinue) -} - -function Install-WingetPackage([string]$Binary, [string]$Id) { - if (Test-CommandExists $Binary) { - Write-Skip $Binary - return - } - - Write-Step "winget install $Id" - $output = winget install --id $Id -e --source winget --accept-package-agreements --accept-source-agreements --silent 2>&1 - - if ($LASTEXITCODE -ne 0) { - $lastLine = ($output | Select-Object -Last 3) -join " / " - Write-Warn "winget install $Id fehlgeschlagen (Binary '$Binary' nicht gefunden): $lastLine -- Pruefen mit: winget search $Id" - return - } - - Write-Ok $Id -} - -function Test-Prerequisites { - if (-not (Test-CommandExists "winget")) { - Write-Host "Fehler: winget wurde nicht gefunden. 'App Installer' aus dem Microsoft Store installieren." -ForegroundColor Red - exit 1 - } -} - -function Main { - Test-Prerequisites - - Install-WingetPackage -Binary "git" -Id "Git.Git" - Install-WingetPackage -Binary "delta" -Id "dandavison.delta" - - Write-Host "" - if ($script:Failures.Count -eq 0) { - Write-Host "Git-Bootstrap abgeschlossen." -ForegroundColor Green - } else { - Write-Host "Git-Bootstrap abgeschlossen, mit $($script:Failures.Count) Warnung(en):" -ForegroundColor Yellow - foreach ($f in $script:Failures) { - Write-Host " - $f" -ForegroundColor Yellow - } - } -} - -Main +#Requires -Version 5.1 +<# + Installiert Git und delta (Pager fuer git/config) per winget. + + Aufruf (keine Admin-Rechte noetig): + .\bootstrap-win\git.ps1 +#> + +$ErrorActionPreference = "Stop" +$script:Failures = @() + +function Write-Ok($msg) { + Write-Host "OK $msg" -ForegroundColor Green +} + +function Write-Step($msg) { + Write-Host "==> $msg" -ForegroundColor Cyan +} + +function Write-Skip($msg) { + Write-Host "- $msg bereits vorhanden" -ForegroundColor DarkGray +} + +function Write-Warn($msg) { + Write-Host "! $msg" -ForegroundColor Yellow + $script:Failures += $msg +} + +function Test-CommandExists([string]$Name) { + return [bool](Get-Command $Name -ErrorAction SilentlyContinue) +} + +function Install-WingetPackage([string]$Binary, [string]$Id) { + if (Test-CommandExists $Binary) { + Write-Skip $Binary + return + } + + Write-Step "winget install $Id" + $output = winget install --id $Id -e --source winget --accept-package-agreements --accept-source-agreements --silent 2>&1 + + if ($LASTEXITCODE -ne 0) { + $lastLine = ($output | Select-Object -Last 3) -join " / " + Write-Warn "winget install $Id fehlgeschlagen (Binary '$Binary' nicht gefunden): $lastLine -- Pruefen mit: winget search $Id" + return + } + + Write-Ok $Id +} + +function Test-Prerequisites { + if (-not (Test-CommandExists "winget")) { + Write-Host "Fehler: winget wurde nicht gefunden. 'App Installer' aus dem Microsoft Store installieren." -ForegroundColor Red + exit 1 + } +} + +function Main { + Test-Prerequisites + + Install-WingetPackage -Binary "git" -Id "Git.Git" + Install-WingetPackage -Binary "delta" -Id "dandavison.delta" + + Write-Host "" + if ($script:Failures.Count -eq 0) { + Write-Host "Git-Bootstrap abgeschlossen." -ForegroundColor Green + } else { + Write-Host "Git-Bootstrap abgeschlossen, mit $($script:Failures.Count) Warnung(en):" -ForegroundColor Yellow + foreach ($f in $script:Failures) { + Write-Host " - $f" -ForegroundColor Yellow + } + } +} + +Main -- cgit v1.3