59 lines
2.4 KiB
PowerShell
59 lines
2.4 KiB
PowerShell
<#
|
|
NetDesk by Akronlogic -- white-label / custom-client generator.
|
|
|
|
Produces a pre-configured, re-brandable portable client by RENAMING the exe so
|
|
it self-configures on first launch (no rebuild, no per-brand signing key
|
|
needed — the single signed NetDesk.exe is reused):
|
|
|
|
powershell -File build-brand.ps1 -Name AcmeRemote -Server vpn.acme.io -Key ACME9 [-Port 8443]
|
|
|
|
Output: dist\brand-<Name>\<Name>-server=<Server>[,port=<Port>][,key=<Key>].exe
|
|
+ the runtime DLLs. Ship the folder as-is; on first launch the client writes
|
|
the relay + registration key into config.json (see core::brand +
|
|
viewer apply_filename_selfconfig). Logo / palette / title theming and a signed
|
|
MSI with a reseller cert are the remaining white-label steps (see BUILD-QUEUE).
|
|
#>
|
|
[CmdletBinding()]
|
|
param(
|
|
[Parameter(Mandatory)][string]$Name,
|
|
[Parameter(Mandatory)][string]$Server,
|
|
[string]$Key = "",
|
|
[string]$Port = "",
|
|
[string]$MingwBin = "C:\mingw-netdesk\mingw64\bin",
|
|
[string]$OutDir = "",
|
|
[switch]$SkipStage
|
|
)
|
|
$ErrorActionPreference = "Stop"
|
|
$Pkg = $PSScriptRoot
|
|
$Stage = Join-Path $Pkg "dist\NetDesk-Portable"
|
|
|
|
# 1. stage the signed portable payload unless told to reuse it.
|
|
if (-not $SkipStage) {
|
|
& (Join-Path $Pkg "build-portable.ps1") -MingwBin $MingwBin -SkipBuild
|
|
}
|
|
if (-not (Test-Path (Join-Path $Stage "NetDesk.exe"))) {
|
|
throw "staged payload missing: $Stage (run build-portable.ps1 first, or omit -SkipStage)"
|
|
}
|
|
|
|
# 2. compose the self-configuring exe name.
|
|
$cfg = "server=$Server"
|
|
if ($Port) { $cfg += ",port=$Port" }
|
|
if ($Key) { $cfg += ",key=$Key" }
|
|
$exeName = "$Name-$cfg.exe"
|
|
|
|
if (-not $OutDir) { $OutDir = Join-Path $Pkg ("dist\brand-" + $Name) }
|
|
New-Item -ItemType Directory -Force -Path $OutDir | Out-Null
|
|
|
|
# 3. the single signed NetDesk.exe is reused verbatim, just renamed; the runtime
|
|
# DLLs travel with it. (The signature stays valid — we rename, not patch.)
|
|
Copy-Item (Join-Path $Stage "NetDesk.exe") (Join-Path $OutDir $exeName) -Force
|
|
foreach ($dll in "libgcc_s_seh-1.dll","libstdc++-6.dll","libwinpthread-1.dll") {
|
|
$src = Join-Path $Stage $dll
|
|
if (Test-Path $src) { Copy-Item $src (Join-Path $OutDir $dll) -Force }
|
|
}
|
|
|
|
$scheme = "wss://$Server"
|
|
if ($Port) { $scheme = "wss://${Server}:$Port" }
|
|
Write-Host "white-label client -> $OutDir\$exeName" -ForegroundColor Green
|
|
Write-Host " pre-pointed at $scheme/ws; self-configures config.json on first launch."
|