From ecbd4fdff1a3d0f2d1bced11e5fa114d09f01b2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Tue, 5 Nov 2024 07:42:22 -0300 Subject: [PATCH] install-from-binstall-release: Add BINSTALL_VERSION (#1955) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allow the users to choose different versions of cargo-binstall Signed-off-by: Patrick José Pereira --- install-from-binstall-release.ps1 | 6 +++++- install-from-binstall-release.sh | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/install-from-binstall-release.ps1 b/install-from-binstall-release.ps1 index a06b25e4..0e0a39c2 100644 --- a/install-from-binstall-release.ps1 +++ b/install-from-binstall-release.ps1 @@ -1,7 +1,11 @@ $ErrorActionPreference = "Stop" Set-PSDebug -Trace 1 $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) if ($proc_arch -eq "AMD64") { $arch = "x86_64" diff --git a/install-from-binstall-release.sh b/install-from-binstall-release.sh index 05e507bf..d87b29eb 100755 --- a/install-from-binstall-release.sh +++ b/install-from-binstall-release.sh @@ -2,9 +2,11 @@ set -euxo pipefail +BINSTALL_VERSION="${BINSTALL_VERSION:-latest}" + 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)" if [ "$os" == "Darwin" ]; then