Files
htl-reverse-proxy-tls-lab/scripts/workshop.ps1
T
2026-05-31 22:47:17 +02:00

37 lines
948 B
PowerShell

param(
[ValidateSet("bootstrap", "up", "redeploy", "proxy-reload", "down", "logs", "reset", "reset-hard", "reset-origin")]
[string]$Action = "bootstrap",
[string]$Distro = ""
)
if (-not (Get-Command wsl.exe -ErrorAction SilentlyContinue)) {
Write-Error "WSL wurde nicht gefunden. Bitte WSL installieren und konfigurieren."
exit 1
}
$repoWinPath = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
$drive = $repoWinPath[0].ToString().ToLower()
$repoWslPath = "/mnt/$drive/" + $repoWinPath.Substring(3) -replace '\\', '/'
if (-not $repoWslPath) {
Write-Error "Konnte den WSL Pfad fuer das Repo nicht ermitteln."
exit 1
}
$linuxCommand = "./scripts/lab.sh $Action"
$wslArgs = @()
if ($Distro) {
$wslArgs += "-d"
$wslArgs += $Distro
}
$wslArgs += "-e"
$wslArgs += "bash"
$wslArgs += "-lc"
$wslArgs += "cd '$repoWslPath' && $linuxCommand"
Write-Host "[info] Running in WSL: $linuxCommand"
& wsl.exe @wslArgs
exit $LASTEXITCODE