winsmux 0.31.0 → 0.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/install.ps1 +40 -26
- package/package.json +1 -1
package/install.ps1
CHANGED
|
@@ -12,7 +12,7 @@ param(
|
|
|
12
12
|
$ErrorActionPreference = 'Stop'
|
|
13
13
|
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
14
14
|
|
|
15
|
-
$VERSION = "0.
|
|
15
|
+
$VERSION = "0.32.1"
|
|
16
16
|
$WINSMUX_DIR = Join-Path $HOME ".winsmux"
|
|
17
17
|
$BIN_DIR = Join-Path $WINSMUX_DIR "bin"
|
|
18
18
|
$BACKUP_DIR = Join-Path $WINSMUX_DIR "backups"
|
|
@@ -28,17 +28,22 @@ $PROFILE_MATRIX = @{
|
|
|
28
28
|
security = "Core profile plus vault, redaction, and audit-oriented scripts."
|
|
29
29
|
full = "Core, orchestra, and security profile contents."
|
|
30
30
|
}
|
|
31
|
-
$
|
|
32
|
-
|
|
31
|
+
$requestedReleaseTag = if ([string]::IsNullOrWhiteSpace($ReleaseTag)) { $env:WINSMUX_RELEASE_TAG } else { $ReleaseTag }
|
|
32
|
+
$UseLatestRelease = [string]::IsNullOrWhiteSpace($requestedReleaseTag) -and $Action.Trim().ToLowerInvariant() -eq 'update'
|
|
33
|
+
if ($UseLatestRelease) {
|
|
34
|
+
$EffectiveReleaseTag = ''
|
|
33
35
|
$BASE_URL = "https://raw.githubusercontent.com/Sora-bluesky/winsmux/main"
|
|
34
36
|
$RELEASE_API_URL = "https://api.github.com/repos/Sora-bluesky/winsmux/releases/latest"
|
|
35
37
|
$RELEASE_LABEL = "latest"
|
|
36
38
|
} else {
|
|
39
|
+
$EffectiveReleaseTag = if ([string]::IsNullOrWhiteSpace($requestedReleaseTag)) { "v$VERSION" } else { $requestedReleaseTag.Trim() }
|
|
37
40
|
$BASE_URL = "https://raw.githubusercontent.com/Sora-bluesky/winsmux/$EffectiveReleaseTag"
|
|
38
41
|
$escapedTag = [Uri]::EscapeDataString($EffectiveReleaseTag)
|
|
39
42
|
$RELEASE_API_URL = "https://api.github.com/repos/Sora-bluesky/winsmux/releases/tags/$escapedTag"
|
|
40
43
|
$RELEASE_LABEL = $EffectiveReleaseTag
|
|
41
44
|
}
|
|
45
|
+
$ResolvedReleaseTag = $EffectiveReleaseTag
|
|
46
|
+
$ResolvedVersion = $VERSION
|
|
42
47
|
|
|
43
48
|
# ---------------------------------------------------------------------------
|
|
44
49
|
# Helpers
|
|
@@ -94,9 +99,9 @@ function Write-InstallProfileManifest {
|
|
|
94
99
|
)
|
|
95
100
|
|
|
96
101
|
$manifest = [ordered]@{
|
|
97
|
-
version = $
|
|
102
|
+
version = $ResolvedVersion
|
|
98
103
|
profile = $Profile
|
|
99
|
-
release_tag = $
|
|
104
|
+
release_tag = $ResolvedReleaseTag
|
|
100
105
|
mode = if ($IsUpdate) { "update" } else { "install" }
|
|
101
106
|
contents = @(Get-InstallProfileContents -Profile $Profile)
|
|
102
107
|
recorded_at = (Get-Date).ToUniversalTime().ToString("o")
|
|
@@ -271,23 +276,6 @@ function Get-WinsmuxCommandVersion {
|
|
|
271
276
|
}
|
|
272
277
|
|
|
273
278
|
function Install-WinsmuxBinary {
|
|
274
|
-
$existing = Get-Command winsmux -ErrorAction SilentlyContinue
|
|
275
|
-
if ($existing) {
|
|
276
|
-
$detected = Get-WinsmuxCommandVersion -CommandInfo $existing
|
|
277
|
-
if ($detected -and $detected.Version -eq $VERSION) {
|
|
278
|
-
Write-Status "winsmux found: $($detected.Output)"
|
|
279
|
-
return
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
if ($detected) {
|
|
283
|
-
Write-Warning "[winsmux] Existing winsmux version '$($detected.Version)' does not match installer version '$VERSION'. Reinstalling release binary."
|
|
284
|
-
} else {
|
|
285
|
-
Write-Warning "[winsmux] Existing winsmux command did not return a compatible version. Reinstalling release binary."
|
|
286
|
-
}
|
|
287
|
-
} else {
|
|
288
|
-
Write-Status "winsmux binary not found. Downloading winsmux-core..."
|
|
289
|
-
}
|
|
290
|
-
|
|
291
279
|
$localBin = Join-Path $HOME ".local/bin"
|
|
292
280
|
$winsmuxExe = Join-Path $localBin "winsmux.exe"
|
|
293
281
|
$headers = @{ "User-Agent" = "winsmux-installer/$VERSION" }
|
|
@@ -300,6 +288,32 @@ function Install-WinsmuxBinary {
|
|
|
300
288
|
|
|
301
289
|
Write-Status "Fetching winsmux-core release ($RELEASE_LABEL)..."
|
|
302
290
|
$release = Invoke-RestMethod -Uri $RELEASE_API_URL -Headers $headers -ErrorAction Stop
|
|
291
|
+
if ([string]::IsNullOrWhiteSpace([string]$release.tag_name)) {
|
|
292
|
+
throw "Release response did not include tag_name."
|
|
293
|
+
}
|
|
294
|
+
$script:ResolvedReleaseTag = [string]$release.tag_name
|
|
295
|
+
$script:ResolvedVersion = $script:ResolvedReleaseTag.TrimStart('v', 'V')
|
|
296
|
+
$script:EffectiveReleaseTag = $script:ResolvedReleaseTag
|
|
297
|
+
$script:BASE_URL = "https://raw.githubusercontent.com/Sora-bluesky/winsmux/$script:ResolvedReleaseTag"
|
|
298
|
+
$script:RELEASE_LABEL = $script:ResolvedReleaseTag
|
|
299
|
+
|
|
300
|
+
$existing = Get-Command winsmux -ErrorAction SilentlyContinue
|
|
301
|
+
if ($existing) {
|
|
302
|
+
$detected = Get-WinsmuxCommandVersion -CommandInfo $existing
|
|
303
|
+
if ($detected -and $detected.Version -eq $script:ResolvedVersion) {
|
|
304
|
+
Write-Status "winsmux found: $($detected.Output)"
|
|
305
|
+
return
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if ($detected) {
|
|
309
|
+
Write-Warning "[winsmux] Existing winsmux version '$($detected.Version)' does not match release version '$script:ResolvedVersion'. Reinstalling release binary."
|
|
310
|
+
} else {
|
|
311
|
+
Write-Warning "[winsmux] Existing winsmux command did not return a compatible version. Reinstalling release binary."
|
|
312
|
+
}
|
|
313
|
+
} else {
|
|
314
|
+
Write-Status "winsmux binary not found. Downloading winsmux-core..."
|
|
315
|
+
}
|
|
316
|
+
|
|
303
317
|
$asset = $release.assets | Where-Object { $_.name -eq $assetName } | Select-Object -First 1
|
|
304
318
|
if (-not $asset -and $assetName -eq "winsmux-arm64.exe") {
|
|
305
319
|
Write-Warning "[winsmux] ARM64 asset not found in release $($release.tag_name). Falling back to winsmux-x64.exe."
|
|
@@ -411,7 +425,7 @@ function Invoke-Install {
|
|
|
411
425
|
param([switch]$IsUpdate)
|
|
412
426
|
$label = if ($IsUpdate) { "Updating" } else { "Installing" }
|
|
413
427
|
$resolvedInstallProfile = Resolve-InstallProfile -PreferExisting:$IsUpdate
|
|
414
|
-
Write-Status "$label winsmux
|
|
428
|
+
Write-Status "$label winsmux with profile '$resolvedInstallProfile' ..."
|
|
415
429
|
|
|
416
430
|
# 1. PowerShell version check
|
|
417
431
|
if ($PSVersionTable.PSVersion.Major -lt 7) {
|
|
@@ -487,20 +501,20 @@ pwsh -NoProfile -File "%USERPROFILE%\.winsmux\bin\winsmux.ps1" %*
|
|
|
487
501
|
$env:PATH = "$BIN_DIR;$env:PATH"
|
|
488
502
|
|
|
489
503
|
# 9. Record version
|
|
490
|
-
$
|
|
504
|
+
$ResolvedVersion | Set-Content $VERSION_FILE
|
|
491
505
|
$resolvedInstallProfile | Set-Content $PROFILE_FILE
|
|
492
506
|
Write-InstallProfileManifest -Profile $resolvedInstallProfile -IsUpdate:$IsUpdate
|
|
493
507
|
|
|
494
508
|
# 10. Completion message
|
|
495
509
|
if ($IsUpdate) {
|
|
496
510
|
Write-Host ""
|
|
497
|
-
Write-Status "Updated to v$
|
|
511
|
+
Write-Status "Updated to v$ResolvedVersion!"
|
|
498
512
|
Write-Host " winsmux: $(Join-Path $BIN_DIR 'winsmux-core.ps1')"
|
|
499
513
|
Write-Host " winsmux config: $confDest"
|
|
500
514
|
Write-Host " install profile: $resolvedInstallProfile"
|
|
501
515
|
} else {
|
|
502
516
|
Write-Host ""
|
|
503
|
-
Write-Status "Installed successfully! (v$
|
|
517
|
+
Write-Status "Installed successfully! (v$ResolvedVersion)"
|
|
504
518
|
Write-Host " winsmux: $(Join-Path $BIN_DIR 'winsmux-core.ps1')"
|
|
505
519
|
Write-Host " winsmux config: $confDest"
|
|
506
520
|
Write-Host " install profile: $resolvedInstallProfile"
|