Fix cargo-binstall installation

Fixes #10
This commit is contained in:
Taiki Endo
2022-07-25 14:47:39 +09:00
parent e6302a3430
commit 31800b17cc
2 changed files with 20 additions and 13 deletions

View File

@@ -10,6 +10,8 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
## [Unreleased] ## [Unreleased]
- Fix cargo-binstall installation on macOS and Windows.
## [1.5.10] - 2022-07-24 ## [1.5.10] - 2022-07-24
- Update `parse-changelog@latest` to 0.5.0. - Update `parse-changelog@latest` to 0.5.0.

View File

@@ -33,7 +33,7 @@ info() {
install_cargo_binstall() { install_cargo_binstall() {
cargo_bin="${CARGO_HOME:-$HOME/.cargo}/bin" cargo_bin="${CARGO_HOME:-$HOME/.cargo}/bin"
if [ ! -f "${cargo_bin}/cargo-binstall" ]; then if [[ ! -f "${cargo_bin}/cargo-binstall" ]]; then
info "installing cargo-binstall" info "installing cargo-binstall"
target="$(rustc -vV | grep host | cut -c 7-)" target="$(rustc -vV | grep host | cut -c 7-)"
@@ -62,7 +62,10 @@ install_cargo_binstall() {
*) bail "unsupported target '${target}' for cargo-binstall" ;; *) bail "unsupported target '${target}' for cargo-binstall" ;;
esac esac
if [ $is_zip = true ]; then mkdir -p .install-action-tmp
(
cd .install-action-tmp
if [[ "${is_zip}" == "true" ]]; then
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "$url" -o "cargo-binstall-${target}.zip" retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "$url" -o "cargo-binstall-${target}.zip"
unzip "cargo-binstall-${target}.zip" unzip "cargo-binstall-${target}.zip"
rm "cargo-binstall-${target}.zip" rm "cargo-binstall-${target}.zip"
@@ -76,6 +79,8 @@ install_cargo_binstall() {
cygwin* | msys*) mv cargo-binstall.exe "${cargo_bin}/" ;; cygwin* | msys*) mv cargo-binstall.exe "${cargo_bin}/" ;;
*) mv cargo-binstall "${cargo_bin}/" ;; *) mv cargo-binstall "${cargo_bin}/" ;;
esac esac
)
rm -rf .install-action-tmp
else else
info "cargo-binstall already installed on in ${cargo_bin}/cargo-binstall" info "cargo-binstall already installed on in ${cargo_bin}/cargo-binstall"
fi fi