winsmux 0.23.0 → 0.23.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 +37 -6
- 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.23.
|
|
15
|
+
$VERSION = "0.23.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"
|
|
@@ -249,13 +249,44 @@ function Get-PreferredReleaseAssetName {
|
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
+
function Get-WinsmuxCommandVersion {
|
|
253
|
+
param([Parameter(Mandatory = $true)]$CommandInfo)
|
|
254
|
+
|
|
255
|
+
try {
|
|
256
|
+
$output = (& $CommandInfo.Source -V 2>&1 | Out-String).Trim()
|
|
257
|
+
if ($LASTEXITCODE -ne 0) {
|
|
258
|
+
return $null
|
|
259
|
+
}
|
|
260
|
+
if ($output -match 'winsmux(?:-[^\s]+)?\s+(?<version>\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)') {
|
|
261
|
+
return [PSCustomObject]@{
|
|
262
|
+
Version = $Matches.version
|
|
263
|
+
Output = $output
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
} catch {
|
|
267
|
+
return $null
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return $null
|
|
271
|
+
}
|
|
272
|
+
|
|
252
273
|
function Install-WinsmuxBinary {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
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..."
|
|
257
289
|
}
|
|
258
|
-
Write-Status "winsmux binary not found. Downloading winsmux-core..."
|
|
259
290
|
|
|
260
291
|
$localBin = Join-Path $HOME ".local/bin"
|
|
261
292
|
$winsmuxExe = Join-Path $localBin "winsmux.exe"
|