mirror of
https://github.com/hansjone/netx.git
synced 2026-10-15 02:33:23 +08:00
Ship a runtime-only PostgreSQL and the small WinSW build.
- PostgreSQL: keep postgres/pg_ctl/initdb/psql/pg_dump(all)/pg_restore/ pg_isready; drop StackBuilder + wx DLLs, dev/test tools, static .lib, pgxs and non-Chinese message catalogs (123MB -> 62MB unpacked). - WinSW: .NET Framework 4.6.1 build (0.6MB, in-box on Win10 1607+ / Server 2016+) instead of the self-contained x64 build (18MB). install_service.ps1 still accepts an older bundled WinSW-x64.exe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
7a4e2b9477
commit
e2e6c09825
2 changed files with 23 additions and 8 deletions
|
|
@ -68,11 +68,13 @@ if (-not $SkipPostgresDownload) {
|
|||
}
|
||||
|
||||
# Bundle WinSW so offline installs can register a Windows Service without GitHub.
|
||||
$winswCache = Join-Path $PSScriptRoot "cache\WinSW-x64.exe"
|
||||
$winswShip = Join-Path $PSScriptRoot "winsw\WinSW-x64.exe"
|
||||
# .NET Framework 4.6.1 build (~0.6MB; in-box on Win10 1607+ / Server 2016+) instead of
|
||||
# the self-contained x64 build (~18MB).
|
||||
$winswCache = Join-Path $PSScriptRoot "cache\WinSW.NET461.exe"
|
||||
$winswShip = Join-Path $PSScriptRoot "winsw\WinSW.exe"
|
||||
if (-not (Test-Path $winswShip)) {
|
||||
if (-not (Test-Path $winswCache)) {
|
||||
$winswUrl = "https://github.com/winsw/winsw/releases/download/v2.12.0/WinSW-x64.exe"
|
||||
$winswUrl = "https://github.com/winsw/winsw/releases/download/v2.12.0/WinSW.NET461.exe"
|
||||
Write-Host "==> Downloading WinSW for offline bundle: $winswUrl"
|
||||
New-Item -ItemType Directory -Path (Split-Path $winswCache -Parent) -Force | Out-Null
|
||||
Invoke-WebRequest -Uri $winswUrl -OutFile $winswCache -UseBasicParsing
|
||||
|
|
@ -137,7 +139,7 @@ if (Test-Path $assetsSrc) {
|
|||
$winswOut = Join-Path $packOut "winsw"
|
||||
New-Item -ItemType Directory -Path $winswOut -Force | Out-Null
|
||||
if (Test-Path $winswShip) {
|
||||
Copy-Item -Path $winswShip -Destination (Join-Path $winswOut "WinSW-x64.exe") -Force
|
||||
Copy-Item -Path $winswShip -Destination (Join-Path $winswOut "WinSW.exe") -Force
|
||||
Write-Host "==> Bundled WinSW for offline service install"
|
||||
} else {
|
||||
Write-Host "[WARN] WinSW missing - offline service install will fail" -ForegroundColor Yellow
|
||||
|
|
@ -155,6 +157,17 @@ if (Test-Path (Join-Path $pgsql "bin\pg_ctl.exe")) {
|
|||
Copy-Item -Path $srcSub -Destination (Join-Path $pgStage $sub) -Recurse -Force
|
||||
}
|
||||
}
|
||||
# Runtime-only subset: NetX uses postgres/pg_ctl/initdb/psql/pg_dump (+ restore/isready
|
||||
# for manual ops). Drop StackBuilder (wx GUI), dev/test tools, static libs, pgxs and
|
||||
# non-Chinese message catalogs.
|
||||
$pgBinKeep = @("postgres", "pg_ctl", "initdb", "psql", "pg_dump", "pg_dumpall", "pg_restore", "pg_isready")
|
||||
Get-ChildItem (Join-Path $pgStage "bin") -File | Where-Object {
|
||||
($_.Extension -eq ".exe" -and $pgBinKeep -notcontains $_.BaseName) -or $_.Name -like "wx*.dll"
|
||||
} | Remove-Item -Force
|
||||
Get-ChildItem (Join-Path $pgStage "lib") -File -Filter *.lib | Remove-Item -Force
|
||||
Remove-Item -Recurse -Force (Join-Path $pgStage "lib\pgxs") -ErrorAction SilentlyContinue
|
||||
Get-ChildItem (Join-Path $pgStage "share\locale") -Directory -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.Name -notlike "zh_CN*" } | Remove-Item -Recurse -Force
|
||||
Get-ChildItem -Path $pgsql -File -ErrorAction SilentlyContinue | ForEach-Object {
|
||||
Copy-Item -Path $_.FullName -Destination (Join-Path $pgStage $_.Name) -Force
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ param(
|
|||
|
||||
# Install NetX as a Windows Service (WinSW) or as a SYSTEM startup Scheduled Task.
|
||||
# Requires elevation for winsw / task modes that run as SYSTEM.
|
||||
# WinSW binary is bundled at packaging\winsw\WinSW-x64.exe by build_release.ps1 — no network needed.
|
||||
# WinSW binary is bundled at packaging\winsw\WinSW.exe by build_release.ps1 — no network needed.
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
. "$PSScriptRoot\_common.ps1"
|
||||
|
|
@ -40,8 +40,10 @@ function Ensure-WinSW {
|
|||
if (-not (Test-Path $cacheDir)) {
|
||||
New-Item -ItemType Directory -Path $cacheDir -Force | Out-Null
|
||||
}
|
||||
$bundled = Join-Path $PSScriptRoot "winsw\WinSW-x64.exe"
|
||||
$dl = Join-Path $cacheDir "WinSW-x64.exe"
|
||||
# WinSW.exe = .NET Framework build (current); WinSW-x64.exe = older self-contained bundles.
|
||||
$bundled = Join-Path $PSScriptRoot "winsw\WinSW.exe"
|
||||
if (-not (Test-Path $bundled)) { $bundled = Join-Path $PSScriptRoot "winsw\WinSW-x64.exe" }
|
||||
$dl = Join-Path $cacheDir "WinSW.NET461.exe"
|
||||
$src = $null
|
||||
if (Test-Path $bundled) {
|
||||
$src = $bundled
|
||||
|
|
@ -50,7 +52,7 @@ function Ensure-WinSW {
|
|||
$src = $dl
|
||||
Write-Host "==> Using cached WinSW: $dl"
|
||||
} elseif ($AllowDownload) {
|
||||
$url = "https://github.com/winsw/winsw/releases/download/v2.12.0/WinSW-x64.exe"
|
||||
$url = "https://github.com/winsw/winsw/releases/download/v2.12.0/WinSW.NET461.exe"
|
||||
Write-Host "==> Downloading WinSW: $url"
|
||||
Invoke-WebRequest -Uri $url -OutFile $dl -UseBasicParsing
|
||||
$src = $dl
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue