#!/usr/bin/env bash set -e BASE_URL="https://cli.whalerider.org" TOOL="wr" echo "" echo "Installing WhaleRider CLI ($TOOL)..." echo "" echo "Using source: $BASE_URL" echo "" echo "Checking latest version..." VERSION=$(curl -s "$BASE_URL/latest") if [ -z "$VERSION" ]; then echo "Could not determine latest version" exit 1 fi echo "Latest version: $VERSION" echo "" OS="linux" ARCH=$(uname -m) case "$ARCH" in x86_64) ARCH="x64" ;; aarch64) ARCH="arm64" ;; *) ARCH="x64" ;; esac echo "Architecture: $ARCH" echo "" ARTIFACT="$TOOL.tar.gz" DOWNLOAD_URL="$BASE_URL/releases/$VERSION/$TOOL/$OS/$ARCH/$ARTIFACT" echo "Downloading $DOWNLOAD_URL" echo "" INSTALL_ROOT="$HOME/.wr" mkdir -p "$INSTALL_ROOT" TMP_FILE="/tmp/$TOOL-$VERSION.tar.gz" curl -L "$DOWNLOAD_URL" -o "$TMP_FILE" echo "Installing..." tar -xzf "$TMP_FILE" -C "$INSTALL_ROOT" # Ensure the binary is executable chmod +x "$INSTALL_ROOT/$TOOL" rm "$TMP_FILE" if ! grep -q "$INSTALL_ROOT" ~/.bashrc; then echo "Adding $INSTALL_ROOT to PATH" echo "export PATH=\$PATH:$INSTALL_ROOT" >> ~/.bashrc fi echo "" echo "WhaleRider CLI installed successfully!" echo "" echo "Run:" echo " $TOOL --help" echo "" echo "Installed location:" echo " $INSTALL_ROOT" echo "" echo "Restart the terminal if the command is not found." echo ""