GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — sqlb/install.ps1 at main · ubgo/sqlb Expand file tree/ Copy pathinstall.ps1More file actions 73 lines (66 loc) · 3.78 KB / Copy pathinstall.ps1File metadata and controls73 lines (66 loc) · 3.78 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 # Code generated by volt v0.2.0 — DO NOT EDIT. # # Regenerate: volt gen install contrib/vet/cmd/sqlb # To change: edit .volt.yml, or the template in volt itself — edits here are lost. # volt:hash bd12a087daf6 # sqlb installer for Windows (PowerShell). # # Usage: # irm https://raw.githubusercontent.com/ubgo/sqlb/main/install.ps1 | iex # $env:VERSION="v1.2.0"; irm ... | iex # pin a version $ErrorActionPreference = "Stop" $Repo = "ubgo/sqlb" $Binary = "sqlb" # Companion programs shipped in the same archive and installed beside it. $ExtraBinaries = "sqlbvet" -split " " | Where-Object { $_ } $InstallDir = if ($env:INSTALL_DIR) { $env:INSTALL_DIR } else { Join-Path $env:LOCALAPPDATA $Binary } $Version = if ($env:VERSION) { $env:VERSION } else { "" } # The release-tag prefix of this CLI's stream: empty for a root CLI (v1.2.0), # "<binary>/" for one in a subdirectory (<binary>/v1.2.0). $TagPrefix = "sqlb/" $arch = if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") { "arm64" } else { "amd64" } if ($Version -and $TagPrefix -and $Version.StartsWith($TagPrefix)) { $Version = $Version.Substring($TagPrefix.Length) } if (-not $Version -and $TagPrefix) { # "latest" is repo-global and may be another stream's release: list this # stream's tags instead (git ls-remote has no API rate limit). if (-not (Get-Command git -ErrorAction SilentlyContinue)) { Write-Error "git is needed to find the newest $Binary release - or set `$env:VERSION"; exit 1 } $Version = git ls-remote --tags --refs "https://github.com/ubgo/sqlb.git" "${TagPrefix}v*" | ForEach-Object { ($_ -split "refs/tags/$TagPrefix")[1] } | Where-Object { $_ -match '^v\d+\.\d+\.\d+$' } | Sort-Object { [version]($_.Substring(1)) } | Select-Object -Last 1 if (-not $Version) { Write-Error "no ${TagPrefix}v* release found in $Repo - set `$env:VERSION"; exit 1 } } # The redirect endpoint has no rate limit; the JSON API allows 60/hr/IP. if ($Version) { $Tag = "$TagPrefix$Version"; $base = "https://github.com/ubgo/sqlb/releases/download/$Tag" } else { $Tag = "latest"; $base = "https://github.com/ubgo/sqlb/releases/latest/download" } if (-not $base) { Write-Error "this forge has no 'latest' redirect - pass a version"; exit 1 } $tmp = Join-Path $env:TEMP ([System.IO.Path]::GetRandomFileName()) New-Item -ItemType Directory -Path $tmp | Out-Null try { Invoke-WebRequest -Uri "$base/checksums.txt" -OutFile (Join-Path $tmp "checksums.txt") $line = Get-Content (Join-Path $tmp "checksums.txt") | Where-Object { $_ -match "_windows_$arch\.zip$" } | Select-Object -First 1 if (-not $line) { throw "release $Tag of $Repo has no windows/$arch build of $Binary" } $sum, $asset = $line -split "\s+", 2 $zip = Join-Path $tmp $asset Write-Host "Downloading $asset..." Invoke-WebRequest -Uri "$base/$asset" -OutFile $zip # Verify BEFORE installing. $actual = (Get-FileHash -Algorithm SHA256 $zip).Hash.ToLower() if ($actual -ne $sum.ToLower()) { throw "checksum verification FAILED for $asset - refusing to install" } Expand-Archive -Path $zip -DestinationPath $tmp -Force New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null Copy-Item (Join-Path $tmp "$Binary.exe") (Join-Path $InstallDir "$Binary.exe") -Force foreach ($extra in $ExtraBinaries) { $src = Join-Path $tmp "$extra.exe" if (Test-Path $src) { Copy-Item $src (Join-Path $InstallDir "$extra.exe") -Force } else { Write-Host "NOTE: $extra is not in release $Tag; skipped." } } $userPath = [Environment]::GetEnvironmentVariable("Path", "User") if ($userPath -notlike "*$InstallDir*") { [Environment]::SetEnvironmentVariable("Path", "$userPath;$InstallDir", "User") Write-Host "Added $InstallDir to user PATH (restart your shell)." } Write-Host "Installed $Binary to $InstallDir\$Binary.exe" } finally { Remove-Item -Recurse -Force $tmp } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |