#Requires -Version 5.1 <# .SYNOPSIS Инициализация машины: SSH, git, клоны (Windows). .DESCRIPTION Вызывает init-machine.sh через Git Bash, если доступен. #> param( [switch]$Verify ) $ErrorActionPreference = 'Stop' $BootstrapRoot = Split-Path -Parent $MyInvocation.MyCommand.Path $ShScript = Join-Path $BootstrapRoot 'init-machine.sh' $envExample = Join-Path $BootstrapRoot 'config\workspace.local.env.example' $envLocal = Join-Path $BootstrapRoot 'config\workspace.local.env' if (-not (Test-Path $envLocal)) { Write-Host "Создайте config\workspace.local.env из workspace.local.env.example" -ForegroundColor Yellow if (Test-Path $envExample) { Copy-Item $envExample $envLocal Write-Host "Скопирован шаблон → workspace.local.env — заполните и запустите снова." } exit 1 } $gitBash = @( "${env:ProgramFiles}\Git\bin\bash.exe", "${env:ProgramFiles(x86)}\Git\bin\bash.exe" ) | Where-Object { Test-Path $_ } | Select-Object -First 1 $args = @() if ($Verify) { $args += '--verify' } if ($gitBash) { & $gitBash $ShScript @args exit $LASTEXITCODE } Write-Host "Git Bash не найден. Установите Git for Windows или выполните вручную:" -ForegroundColor Red Write-Host " bash init-machine.sh $($args -join ' ')" exit 1