Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust the macOS/Linux installation script to not be silent on errors #44

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions scripts/install.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/usr/bin/env bash
set -e
set -ex

RELEASES_URL="https://github.com/shipyard/shipyard-cli/releases"

last_version() {
curl --silent --location --fail \
--output /dev/null --write-out %{url_effective} ${RELEASES_URL}/latest |
curl --silent --show-error --location --fail \
--output /dev/null \
--write-out "%{url_effective}" "$RELEASES_URL/latest" |
grep -Eo '[0-9]+\.[0-9]+\.[0-9]+$'
}

Expand All @@ -18,15 +19,16 @@ main() {
arm64 | aarch64) ARCH="arm64" ;;
esac

[[ -z "$ARCH" ]] && { echo "Platform not supported. Please contact support." ; exit 1; }
[[ -z "$ARCH" ]] && { echo "Platform not supported."; exit 1; }

VERSION="$(last_version)"
echo "Downloading latest binary..."
echo "Downloading the latest binary..."
URL="${RELEASES_URL}/download/v${VERSION}/shipyard-$(uname -s)-${ARCH}"

curl --silent -L --output "${default_dir}/shipyard" --fail "$URL"
chmod +x ${default_dir}/shipyard
curl --silent --show-error --location --fail --output "${PWD}/shipyard" "$URL"
chmod +x shipyard
sudo mv shipyard "$default_dir"
echo "Installation Complete! Run 'shipyard --help' to get started."
}

main "$@"
main "$@"
Loading