Skip to content
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
100 changes: 51 additions & 49 deletions install/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ REPO="HiveSofts/hive-cli"
BINARY="hive"
INSTALL_DIR="/usr/local/bin"

# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
Expand All @@ -15,96 +14,99 @@ CYAN='\033[0;36m'
BOLD='\033[1m'
RESET='\033[0m'


echo ""
echo -e "${CYAN}${BOLD} 🐝 Hive CLI Installer${RESET}"
echo -e "${BLUE} ━━━━━━━━━━━━━━━━━━━━${RESET}"
echo ""

# Detect latest version

echo -e "${YELLOW} ⏳ Detecting latest version...${RESET}"
VERSION=$(curl -s https://api.github.com/repos/$REPO/releases/latest \
| grep '"tag_name":' \
| sed -E 's/.*"([^"]+)".*/\1/')

VERSION=$(curl -fsSL \
"https://api.github.com/repos/$REPO/releases/latest" \
| grep '"tag_name":' \
| sed -E 's/.*"([^"]+)".*/\1/')


if [ -z "$VERSION" ]; then
echo -e "${RED} ❌ Failed to detect latest Hive version${RESET}"
echo -e "${RED} ❌ Failed to detect latest version${RESET}"
exit 1
fi

echo -e "${GREEN} ✅ Version: ${BOLD}${VERSION}${RESET}"

echo -e "${GREEN} ✅ Version: ${BOLD}$VERSION${RESET}"
echo ""

# Detect OS
OS="$(uname -s)"
ARCH="$(uname -m)"

case "$OS" in
Linux)
PLATFORM="linux"
;;
Darwin)
PLATFORM="macos"
;;
*)
echo -e "${RED} ❌ Unsupported operating system: $OS${RESET}"
exit 1
;;
esac

case "$ARCH" in
x86_64|amd64)
ARCH="x86_64"
;;
aarch64|arm64)
ARCH="aarch64"
;;
*)
echo -e "${RED} ❌ Unsupported architecture: $ARCH${RESET}"
exit 1
;;
esac

ASSET="hive-$PLATFORM"
DOWNLOAD_URL="https://github.com/$REPO/releases/download/$VERSION/$ASSET"

echo -e "${YELLOW} ⬇️ Downloading Hive...${RESET}"
echo -e "${BLUE} ${DOWNLOAD_URL}${RESET}"


DOWNLOAD_URL="https://github.com/$REPO/releases/download/$VERSION/hive"


echo -e "${BLUE} $DOWNLOAD_URL${RESET}"
echo ""


TMP=$(mktemp)

# Download with progress
curl -L --progress-bar "$DOWNLOAD_URL" -o "$TMP"

curl -fL --progress-bar \
"$DOWNLOAD_URL" \
-o "$TMP"


if [ ! -s "$TMP" ]; then
echo -e "${RED} ❌ Download failed — file is empty${RESET}"
echo -e "${RED} ❌ Download failed${RESET}"
exit 1
fi


# Check downloaded file
if file "$TMP" | grep -qi "text"; then
echo -e "${RED} ❌ Downloaded file is not a binary${RESET}"
cat "$TMP"
exit 1
fi


chmod +x "$TMP"


echo ""
echo -e "${YELLOW} 📦 Installing Hive...${RESET}"


if [ -w "$INSTALL_DIR" ]; then
mv "$TMP" "$INSTALL_DIR/$BINARY"
else
sudo mv "$TMP" "$INSTALL_DIR/$BINARY"
fi


sudo chmod +x "$INSTALL_DIR/$BINARY"


echo ""
echo -e "${GREEN}${BOLD} ✅ Hive installed successfully!${RESET}"
echo ""

# Test installation
if command -v hive &> /dev/null; then

if command -v hive >/dev/null 2>&1; then

echo -e "${CYAN} Version:${RESET}"
hive --version 2>/dev/null || echo -e "${YELLOW} (version info not available)${RESET}"
hive --version || true

else
echo -e "${YELLOW} ⚠️ Hive not found in PATH. Try:${RESET}"
echo -e " export PATH=\$PATH:$INSTALL_DIR"

echo -e "${YELLOW} ⚠️ Hive not found in PATH${RESET}"

fi


echo ""
echo -e "${CYAN}${BOLD} 🚀 Get started:${RESET}"
echo -e " ${BOLD}hive --help${RESET}"
echo ""
echo " hive --help"
echo ""
Loading