mbproxy/install: add Windows service-management batch files
Four simple .bat files — install / remove / start / stop-service — that manage the 'mbproxy' Windows service against the Mbproxy.exe in their own folder. publish.ps1 / publish.sh copy them into each win-* publish flavour, so a published Windows folder is self-managing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,7 +12,8 @@
|
||||
|
||||
Each folder also receives a current appsettings.json — the platform-appropriate
|
||||
install template (Windows or Linux, selected by -Rid) — so every publish-out
|
||||
flavour is a complete, deployable folder.
|
||||
flavour is a complete, deployable folder. For a win-* RID the four service
|
||||
batch files (install/remove/start/stop-service.bat) are copied in as well.
|
||||
|
||||
The runtime is selected with -Rid (default win-x64). The binary is Mbproxy.exe on
|
||||
Windows RIDs and Mbproxy on Linux/macOS RIDs.
|
||||
@@ -93,6 +94,22 @@ foreach ($flavour in 'self-contained','framework-dependent') {
|
||||
Write-Host (" {0,-22} <- {1}" -f $flavour, $configTemplate)
|
||||
}
|
||||
|
||||
# ── Ship the Windows service-management batch files (win RIDs only) ─────────────
|
||||
# install-service / remove-service / start-service / stop-service all act on the
|
||||
# Mbproxy.exe in their own folder, so the published folder is self-managing.
|
||||
if ($Rid -like 'win-*') {
|
||||
$serviceScripts = 'install-service.bat','remove-service.bat','start-service.bat','stop-service.bat'
|
||||
Write-Host "`n=== Service scripts ===" -ForegroundColor Cyan
|
||||
foreach ($flavour in 'self-contained','framework-dependent') {
|
||||
foreach ($script in $serviceScripts) {
|
||||
$src = Join-Path $repoRoot "install\$script"
|
||||
if (-not (Test-Path $src)) { throw "Cannot find service script: $src" }
|
||||
Copy-Item -LiteralPath $src -Destination (Join-Path $OutputDir "$flavour\$script") -Force
|
||||
}
|
||||
Write-Host (" {0,-22} <- install\*-service.bat" -f $flavour)
|
||||
}
|
||||
}
|
||||
|
||||
function Format-Size {
|
||||
param([long]$Bytes)
|
||||
if ($Bytes -ge 1MB) { '{0:N1} MB' -f ($Bytes / 1MB) }
|
||||
|
||||
Reference in New Issue
Block a user