Files
reverse-proxy/scripts/workspace-bootstrap/init-machine.ps1
T
Andrey Lutsenko 834595df6b feat: workspace-bootstrap — init SSH/git/Cursor для Mac и Windows
Единый workspace.local.env для адресов и паролей, init-machine,
Set-GitRemotes, push-safe и check-no-secrets для политики kalinamall/github.
2026-06-14 19:34:52 +10:00

43 lines
1.4 KiB
PowerShell

#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