-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·64 lines (51 loc) · 1.54 KB
/
install.sh
File metadata and controls
executable file
·64 lines (51 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
set -e
VERSION="latest"
REPO="Blankeos/crabcode"
INSTALL_DIR="$HOME/.local/bin"
BINARY_NAME="crabcode"
echo "🦀 Installing crabcode..."
# Check if cargo is available
if command -v cargo &> /dev/null; then
echo "📦 Installing via cargo..."
cargo install crabcode
echo "✓ crabcode installed successfully via cargo"
echo ""
echo "Run: crabcode"
exit 0
fi
# Fall back to downloading pre-built binary
echo "⬇️ Downloading pre-built binary..."
# Determine platform
OS="$(uname -s)"
ARCH="$(uname -m)"
case "$OS" in
Linux*) OS="linux";;
Darwin*) OS="macos";;
*) echo "❌ Unsupported OS: $OS"; exit 1;;
esac
case "$ARCH" in
x86_64) ARCH="x86_64";;
aarch64) ARCH="aarch64";;
*) echo "❌ Unsupported architecture: $ARCH"; exit 1;;
esac
# Create install directory
mkdir -p "$INSTALL_DIR"
# Download binary
BINARY_URL="https://github.com/${REPO}/releases/download/${VERSION}/crabcode-${OS}-${ARCH}"
if curl -L "$BINARY_URL" -o "$INSTALL_DIR/$BINARY_NAME"; then
chmod +x "$INSTALL_DIR/$BINARY_NAME"
echo "✓ crabcode installed successfully to $INSTALL_DIR/$BINARY_NAME"
else
echo "❌ Failed to download binary. Please install via cargo: cargo install crabcode"
exit 1
fi
# Add to PATH if not already there
if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
echo ""
echo "⚠️ Add $INSTALL_DIR to your PATH:"
echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
echo " Add this to your ~/.bashrc or ~/.zshrc"
fi
echo ""
echo "Run: $BINARY_NAME"