refactor(§7.5): rinomina Setup-* Install-CIToolchain-* (WinBuild2025/2022/Linux2404)
- template/Setup-WinBuild2025.ps1 Install-CIToolchain-WinBuild2025.ps1 - template/Setup-WinBuild2022.ps1 Install-CIToolchain-WinBuild2022.ps1 - template/Setup-LinuxBuild2404.sh Install-CIToolchain-Linux2404.sh Aggiornati tutti i riferimenti in: Prepare-WinBuild2025/2022, Prepare-LinuxBuild2404, Deploy-WinBuild2025/2022/LinuxBuild2404, Validate-DeployState, Validate-SetupState, README.md, TODO.md, docs/WINDOWS-TEMPLATE-SETUP.md, docs/LINUX-TEMPLATE-SETUP.md, docs/TEST-PLAN-v1.3-to-HEAD.md, gitea/actions/local-ci-build/action.yml. §7 chiuso (5/5 done).
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#Requires -Version 5.1
|
||||
#Requires -Version 5.1
|
||||
<#
|
||||
.SYNOPSIS
|
||||
HOST-side script: delivers and runs Setup-LinuxBuild2404.sh inside the Linux template VM.
|
||||
HOST-side script: delivers and runs Install-CIToolchain-Linux2404.sh inside the Linux template VM.
|
||||
|
||||
.DESCRIPTION
|
||||
Automates provisioning of the Ubuntu 24.04 template VM from the host machine via SSH/SCP:
|
||||
@@ -9,8 +9,8 @@
|
||||
IPv4 address valid, TCP/22 reachable
|
||||
2. Auto power-on + guest IP detection via vmrun getGuestIPAddress (when -VMXPath provided)
|
||||
3. Add host key to known_hosts (idempotent, uses StrictHostKeyChecking=accept-new)
|
||||
4. Copy Setup-LinuxBuild2404.sh to /tmp on guest via scp + validate file size
|
||||
5. Execute Setup-LinuxBuild2404.sh via SSH (stdout/stderr streamed to host console)
|
||||
4. Copy Install-CIToolchain-Linux2404.sh to /tmp on guest via scp + validate file size
|
||||
5. Execute Install-CIToolchain-Linux2404.sh via SSH (stdout/stderr streamed to host console)
|
||||
6. Post-setup remote validation batch check (user, sudo, tools, CI dirs, swap, sshd)
|
||||
7. Graceful shutdown + vmrun snapshot (when -TakeSnapshot or -VMXPath provided)
|
||||
Final: print summary
|
||||
@@ -56,13 +56,13 @@
|
||||
Must match the snapshot name used in New-BuildVM.ps1.
|
||||
|
||||
.PARAMETER SkipUpdate
|
||||
Pass --skip-update to Setup-LinuxBuild2404.sh (skips apt-get upgrade).
|
||||
Pass --skip-update to Install-CIToolchain-Linux2404.sh (skips apt-get upgrade).
|
||||
|
||||
.PARAMETER InstallDotNet
|
||||
Pass --dotnet to Setup-LinuxBuild2404.sh (installs .NET SDK).
|
||||
Pass --dotnet to Install-CIToolchain-Linux2404.sh (installs .NET SDK).
|
||||
|
||||
.PARAMETER NoMingw
|
||||
Pass --no-mingw to Setup-LinuxBuild2404.sh (skips MinGW cross-compiler).
|
||||
Pass --no-mingw to Install-CIToolchain-Linux2404.sh (skips MinGW cross-compiler).
|
||||
MinGW is installed by default; use this only to skip it.
|
||||
|
||||
.PARAMETER TakeSnapshot
|
||||
@@ -278,26 +278,26 @@ if ($LASTEXITCODE -ne 0) {
|
||||
}
|
||||
Write-Host " [OK] SSH connectivity confirmed, host key added."
|
||||
|
||||
# ── Step 5 — Copy Setup-LinuxBuild2404.sh into VM ────────────────────────────
|
||||
Write-Host "[Prepare] Step 5 — Copying Setup-LinuxBuild2404.sh to guest..."
|
||||
# ── Step 5 — Copy Install-CIToolchain-Linux2404.sh into VM ────────────────────────────
|
||||
Write-Host "[Prepare] Step 5 — Copying Install-CIToolchain-Linux2404.sh to guest..."
|
||||
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$setupScript = Join-Path $scriptDir 'Setup-LinuxBuild2404.sh'
|
||||
$guestScript = '/tmp/Setup-LinuxBuild2404.sh'
|
||||
$setupScript = Join-Path $scriptDir 'Install-CIToolchain-Linux2404.sh'
|
||||
$guestScript = '/tmp/Install-CIToolchain-Linux2404.sh'
|
||||
|
||||
if (-not (Test-Path $setupScript -PathType Leaf)) {
|
||||
throw "[Prepare Step 5] Setup-LinuxBuild2404.sh not found alongside this script: $setupScript"
|
||||
throw "[Prepare Step 5] Install-CIToolchain-Linux2404.sh not found alongside this script: $setupScript"
|
||||
}
|
||||
|
||||
# Strip UTF-8 BOM and normalize CRLF→LF before copying.
|
||||
# PS 5.1 / VS Code on Windows may save .sh files with BOM or CRLF; both break bash.
|
||||
$shBytes = [System.IO.File]::ReadAllBytes($setupScript)
|
||||
if ($shBytes.Length -ge 3 -and $shBytes[0] -eq 0xEF -and $shBytes[1] -eq 0xBB -and $shBytes[2] -eq 0xBF) {
|
||||
Write-Host " [WARN] UTF-8 BOM detected in Setup-LinuxBuild2404.sh — stripping before copy"
|
||||
Write-Host " [WARN] UTF-8 BOM detected in Install-CIToolchain-Linux2404.sh — stripping before copy"
|
||||
$shBytes = $shBytes[3..($shBytes.Length - 1)]
|
||||
}
|
||||
$shText = [System.Text.Encoding]::UTF8.GetString($shBytes) -replace "`r`n", "`n" -replace "`r", "`n"
|
||||
$tmpScript = Join-Path $env:TEMP 'Setup-LinuxBuild2404-ci.sh'
|
||||
$tmpScript = Join-Path $env:TEMP 'Install-CIToolchain-Linux2404-ci.sh'
|
||||
[System.IO.File]::WriteAllText($tmpScript, $shText, [System.Text.UTF8Encoding]::new($false))
|
||||
$setupScript = $tmpScript
|
||||
|
||||
@@ -322,7 +322,7 @@ Assert-Step 'FileCopy' "guest script size matches local ($localSize bytes, remot
|
||||
}
|
||||
|
||||
# ── Step 6 — Execute setup script ────────────────────────────────────────────
|
||||
Write-Host "[Prepare] Step 6 — Running Setup-LinuxBuild2404.sh in guest (may take several minutes)..."
|
||||
Write-Host "[Prepare] Step 6 — Running Install-CIToolchain-Linux2404.sh in guest (may take several minutes)..."
|
||||
|
||||
$setupFlags = [System.Collections.Generic.List[string]]::new()
|
||||
if ($SkipUpdate) { $setupFlags.Add('--skip-update') }
|
||||
@@ -340,7 +340,7 @@ $setupExitCode = $LASTEXITCODE
|
||||
|
||||
Write-Host "------------------------------------------------------------"
|
||||
if ($setupExitCode -ne 0) {
|
||||
throw "[Prepare Step 6] Setup-LinuxBuild2404.sh exited $setupExitCode — see output above."
|
||||
throw "[Prepare Step 6] Install-CIToolchain-Linux2404.sh exited $setupExitCode — see output above."
|
||||
}
|
||||
Write-Host "[Prepare] Setup script completed (exit 0)." -ForegroundColor Green
|
||||
|
||||
@@ -435,3 +435,4 @@ if ($TakeSnapshot -or $VMXPath -ne '') {
|
||||
} else {
|
||||
Write-Host " Snapshot: not taken — run manually then use -SnapshotName '$SnapshotName'"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user