mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 20:13:15 +08:00
Release 0.4.5: installer DB wizard, credential key, lean offline Setup.
Choose bundled or external PostgreSQL in the Setup wizard with connection validation; optional NETX_CREDENTIAL_SECRET_KEY; single desktop shortcut; faster uninstall and tray startup for offline Windows packages. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
86dfd41f44
commit
97393cd407
20 changed files with 1531 additions and 146 deletions
53
packaging/uninstall_delete_data.ps1
Normal file
53
packaging/uninstall_delete_data.ps1
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
param(
|
||||
[string]$DataRoot = ""
|
||||
)
|
||||
|
||||
# Post-uninstall optional data wipe with retries (handles briefly locked runtime logs).
|
||||
|
||||
$ErrorActionPreference = "Continue"
|
||||
if (-not $DataRoot) {
|
||||
$DataRoot = Join-Path ([Environment]::GetFolderPath("CommonApplicationData")) "NetX"
|
||||
}
|
||||
|
||||
if (-not (Test-Path -LiteralPath $DataRoot)) {
|
||||
Write-Host "==> Data root already gone: $DataRoot"
|
||||
exit 0
|
||||
}
|
||||
|
||||
Write-Host "==> Deleting data root: $DataRoot"
|
||||
|
||||
# Kill anything still holding files under data root.
|
||||
Get-CimInstance Win32_Process -ErrorAction SilentlyContinue | Where-Object {
|
||||
$_.CommandLine -and ($_.CommandLine.IndexOf($DataRoot, [StringComparison]::OrdinalIgnoreCase) -ge 0)
|
||||
} | ForEach-Object {
|
||||
try { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue } catch {}
|
||||
try { & taskkill.exe /F /PID $_.ProcessId 2>$null | Out-Null } catch {}
|
||||
}
|
||||
|
||||
$ok = $false
|
||||
for ($i = 1; $i -le 5; $i++) {
|
||||
try {
|
||||
cmd /c "rmdir /s /q `"$DataRoot`""
|
||||
} catch {}
|
||||
if (-not (Test-Path -LiteralPath $DataRoot)) {
|
||||
$ok = $true
|
||||
break
|
||||
}
|
||||
Start-Sleep -Seconds 1
|
||||
}
|
||||
|
||||
if (-not $ok -and (Test-Path -LiteralPath $DataRoot)) {
|
||||
try {
|
||||
takeown /F $DataRoot /R /D Y | Out-Null
|
||||
icacls $DataRoot /grant Administrators:F /T | Out-Null
|
||||
cmd /c "rmdir /s /q `"$DataRoot`""
|
||||
} catch {}
|
||||
}
|
||||
|
||||
if (Test-Path -LiteralPath $DataRoot) {
|
||||
Write-Host "[WARN] Could not fully delete $DataRoot"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "==> Data root deleted"
|
||||
exit 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue