mirror of
https://github.com/hansjone/netxops.git
synced 2026-10-20 07:40:46 +08:00
Harden public package installation and release validation
This commit is contained in:
parent
9271494b37
commit
9b2166e5b6
41 changed files with 994 additions and 363 deletions
|
|
@ -1,21 +1,4 @@
|
|||
# Link / install presets/netxops into the DSH user agent-presets root.
|
||||
# Prefer a real directory copy: DSH discovery skips Windows junctions
|
||||
# (Dirent.isDirectory() is false for reparse points).
|
||||
$ErrorActionPreference = "Stop"
|
||||
$RepoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$Source = Join-Path $RepoRoot "presets\netxops"
|
||||
$DshHome = if ($env:DSH_HOME) { $env:DSH_HOME } else { Join-Path $env:USERPROFILE ".dsh" }
|
||||
$TargetParent = Join-Path $DshHome ".agent-presets"
|
||||
$Target = Join-Path $TargetParent "netxops"
|
||||
|
||||
if (-not (Test-Path (Join-Path $Source "agent.cordis.yml"))) {
|
||||
throw "Missing preset dir: $Source"
|
||||
}
|
||||
New-Item -ItemType Directory -Force -Path $TargetParent | Out-Null
|
||||
if (Test-Path $Target) {
|
||||
Remove-Item -Recurse -Force $Target
|
||||
}
|
||||
Copy-Item -Recurse -Force $Source $Target
|
||||
Set-Content -Path (Join-Path $Target ".dsh-netxops-managed") -Value ((Get-Date).ToString("o"))
|
||||
Write-Host "Installed $Target (copy from $Source)"
|
||||
Write-Host "Open Settings → Agent presets → Custom → Netx Ops (or new session)."
|
||||
param([ValidatePattern('^[\w-]+$')][string]$Profile = 'desktop')
|
||||
$ErrorActionPreference = 'Stop'
|
||||
& node (Join-Path $PSScriptRoot 'install-preset.mjs') --profile $Profile
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Preset installation failed.' }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue