install-from-binstall-release: Add BINSTALL_VERSION (#1955)

This allow the users to choose different versions of cargo-binstall

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
This commit is contained in:
Patrick José Pereira 2024-11-05 07:42:22 -03:00 committed by GitHub
parent 4bf3685328
commit ecbd4fdff1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View file

@ -1,7 +1,11 @@
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
Set-PSDebug -Trace 1 Set-PSDebug -Trace 1
$tmpdir = $Env:TEMP $tmpdir = $Env:TEMP
$base_url = "https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-" $BINSTALL_VERSION = $Env:BINSTALL_VERSION
if (-not $BINSTALL_VERSION) {
$BINSTALL_VERSION = 'latest'
}
$base_url = "https://github.com/cargo-bins/cargo-binstall/releases/$BINSTALL_VERSION/download/cargo-binstall-"
$proc_arch = [Environment]::GetEnvironmentVariable("PROCESSOR_ARCHITECTURE", [EnvironmentVariableTarget]::Machine) $proc_arch = [Environment]::GetEnvironmentVariable("PROCESSOR_ARCHITECTURE", [EnvironmentVariableTarget]::Machine)
if ($proc_arch -eq "AMD64") { if ($proc_arch -eq "AMD64") {
$arch = "x86_64" $arch = "x86_64"

View file

@ -2,9 +2,11 @@
set -euxo pipefail set -euxo pipefail
BINSTALL_VERSION="${BINSTALL_VERSION:-latest}"
cd "$(mktemp -d)" cd "$(mktemp -d)"
base_url="https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-" base_url="https://github.com/cargo-bins/cargo-binstall/releases/${BINSTALL_VERSION}/download/cargo-binstall-"
os="$(uname -s)" os="$(uname -s)"
if [ "$os" == "Darwin" ]; then if [ "$os" == "Darwin" ]; then