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 Linux/MacOS (#1074)
Fixed #1073 Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
306f5d7e3d
commit
c9806cce78
2 changed files with 40 additions and 0 deletions
34
install-from-binstall-release.sh
Executable file
34
install-from-binstall-release.sh
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
cd "$(mktemp -d)"
|
||||
|
||||
base_url="https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-"
|
||||
|
||||
os="$(uname -o)"
|
||||
if [ "$os" == "Darwin" ]; then
|
||||
url="${base_url}universal-apple-darwin.zip"
|
||||
curl -LO --proto '=https' --tlsv1.2 -sSf "$url"
|
||||
unzip cargo-binstall-universal-apple-darwin.zip
|
||||
elif [ "$os" == "GNU/Linux" ]; then
|
||||
machine="$(uname -m)"
|
||||
target="${machine}-unknown-linux-musl"
|
||||
if [ "$machine" == "armv7" ]; then
|
||||
target="${target}eabihf"
|
||||
fi
|
||||
|
||||
url="${base_url}${target}.tgz"
|
||||
curl -L --proto '=https' --tlsv1.2 -sSf "$url" | tar -xvzf -
|
||||
else
|
||||
echo "Unupporteed OS ${os}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
./cargo-binstall -y --force cargo-binstall
|
||||
|
||||
if ! [[ ":$PATH:" == *":$HOME/.cargo/bin:"* ]]; then
|
||||
echo
|
||||
printf "\033[0;31mYour path is missing ~/.cargo/bin, you might want to add it.\033[0m\n"
|
||||
echo
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue