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]
- Fix cargo-binstall installation on macOS and Windows.
## [1.5.10] - 2022-07-24
- Update `parse-changelog@latest` to 0.5.0.

31
main.sh
View File

@@ -33,7 +33,7 @@ info() {
install_cargo_binstall() {
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"
target="$(rustc -vV | grep host | cut -c 7-)"
@@ -62,20 +62,25 @@ install_cargo_binstall() {
*) bail "unsupported target '${target}' for cargo-binstall" ;;
esac
if [ $is_zip = true ]; then
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "$url" -o "cargo-binstall-${target}.zip"
unzip "cargo-binstall-${target}.zip"
rm "cargo-binstall-${target}.zip"
else
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "$url" | tar xzf -
fi
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"
unzip "cargo-binstall-${target}.zip"
rm "cargo-binstall-${target}.zip"
else
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "$url" | tar xzf -
fi
mkdir -p "{cargo_bin}/"
mkdir -p "{cargo_bin}/"
case "${OSTYPE}" in
cygwin* | msys*) mv cargo-binstall.exe "${cargo_bin}/" ;;
*) mv cargo-binstall "${cargo_bin}/" ;;
esac
case "${OSTYPE}" in
cygwin* | msys*) mv cargo-binstall.exe "${cargo_bin}/" ;;
*) mv cargo-binstall "${cargo_bin}/" ;;
esac
)
rm -rf .install-action-tmp
else
info "cargo-binstall already installed on in ${cargo_bin}/cargo-binstall"
fi