mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-25 06:40:03 +00:00
Add one-liner for installing cargo-binstall
on Windows (#1099)
* Add one-liner for installing `cargo-binstall` on Windows * Change command separator to semicolon `&&` was added in Powershell 7 * Update win install script to exit on error and trace
This commit is contained in:
parent
b876bdc8c7
commit
a849db3ef4
2 changed files with 31 additions and 0 deletions
25
install-from-binstall-release.ps1
Normal file
25
install-from-binstall-release.ps1
Normal file
|
@ -0,0 +1,25 @@
|
|||
$ErrorActionPreference = "Stop"
|
||||
Set-PSDebug -Trace 1
|
||||
$tmpdir = $Env:TEMP
|
||||
$base_url = "https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-"
|
||||
$type = (Get-ComputerInfo).CsSystemType.ToLower()
|
||||
if ($type.StartsWith("x64")) {
|
||||
$arch = "x86_64"
|
||||
} elseif ($type.StartsWith("arm64")) {
|
||||
$arch = "aarch64"
|
||||
} else {
|
||||
Write-Host "Unsupported Architecture: $type" -ForegroundColor Red
|
||||
[Environment]::Exit(1)
|
||||
}
|
||||
$url = "$base_url$arch-pc-windows-msvc.zip"
|
||||
Invoke-WebRequest $url -OutFile $tmpdir\cargo-binstall.zip
|
||||
Expand-Archive -Force $tmpdir\cargo-binstall.zip $tmpdir\cargo-binstall
|
||||
Write-Host ""
|
||||
Invoke-Expression "$tmpdir\cargo-binstall\cargo-binstall.exe -y --force cargo-binstall"
|
||||
Remove-Item -Force $tmpdir\cargo-binstall.zip
|
||||
Remove-Item -Recurse -Force $tmpdir\cargo-binstall
|
||||
if ($Env:Path -split ";" -notcontains "$HOME\.cargo\bin") {
|
||||
Write-Host ""
|
||||
Write-Host "Your path is missing $HOME\.cargo\bin, you might want to add it." -ForegroundColor Red
|
||||
Write-Host ""
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue