feat(webi): probe zst as unpacker; properly probe formats in webi-pwsh

webi/webi.sh: detect unzstd/zstd alongside the existing git/unxz/
unzip/tar probes. Sends `?formats=...,zst` when zstd is available so
the server can pick a .tar.zst build only on hosts that can extract
it.

webi/webi-pwsh.ps1: replace the hardcoded `formats=zip,exe,tar,git`
TODO with real Get-Command probing for git, zstd, and 7z.
This commit is contained in:
AJ ONeal
2026-05-06 23:23:02 -06:00
parent 28cd129a23
commit 2d1c082e30
2 changed files with 8 additions and 2 deletions

View File

@@ -194,8 +194,11 @@ Write-Host "${TTask}Installing${TReset} ${TName}${exename}${TReset}"
Write-Host " ${TDim}Fetching install script ...${TReset}"
$PKG_URL = "$Env:WEBI_HOST/api/installers/$exename.ps1"
# TODO detect formats
$UrlParams = "formats=zip,exe,tar,git&libc=msvc"
$DetectedFormats = @("zip", "exe", "tar")
if (Get-Command git -ErrorAction SilentlyContinue) { $DetectedFormats += "git" }
if (Get-Command zstd -ErrorAction SilentlyContinue) { $DetectedFormats += "zst" }
if (Get-Command 7z -ErrorAction SilentlyContinue) { $DetectedFormats += "7z" }
$UrlParams = "formats=$($DetectedFormats -join ',')&libc=msvc"
$PkgInstallPwsh = "$HOME\.local\tmp\$exename.install.ps1"
Invoke-DownloadUrl -Force -URL $PKG_URL -Params $UrlParams -Path $PkgInstallPwsh

View File

@@ -40,6 +40,9 @@ __webi_main() {
if [ -n "$(command -v git)" ]; then
my_ext="git,$my_ext"
fi
if [ -n "$(command -v unzstd)" ] || [ -n "$(command -v zstd)" ]; then
my_ext="zst,$my_ext"
fi
if [ -n "$(command -v unxz)" ]; then
my_ext="xz,$my_ext"
fi