-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·104 lines (86 loc) · 2.74 KB
/
install.sh
File metadata and controls
executable file
·104 lines (86 loc) · 2.74 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
# Agentkernel installer
#
# This script installs agentkernel and its dependencies.
# Run with: curl -fsSL https://raw.githubusercontent.com/thrashr888/agentkernel/main/install.sh | sh
#
# After installation, run: agentkernel setup
#
# Environment variables:
# INSTALL_DIR - Where to install the binary (default: ~/.local/bin)
# USE_CARGO=1 - Force building from source via cargo instead of downloading
set -euo pipefail
REPO="thrashr888/agentkernel"
INSTALL_DIR="${INSTALL_DIR:-$HOME/.local/bin}"
echo "=== Agentkernel Installer ==="
echo ""
# Detect OS and architecture
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
ARCH="$(uname -m)"
case "$ARCH" in
x86_64) ARCH_LABEL="x64" ;;
aarch64|arm64) ARCH_LABEL="arm64" ;;
*)
echo "Error: Unsupported architecture: $ARCH"
exit 1
;;
esac
echo "Detected: $OS/$ARCH_LABEL"
# Force cargo build if requested
if [ "${USE_CARGO:-}" = "1" ]; then
if ! command -v cargo &>/dev/null; then
echo "Error: USE_CARGO=1 but cargo not found."
exit 1
fi
echo ""
echo "Installing via Cargo (forced)..."
cargo install --git "https://github.com/$REPO" agentkernel --force
echo ""
echo "=== Installation Complete ==="
echo "Next step: Run 'agentkernel setup' to download required components."
exit 0
fi
# Download prebuilt binary from GitHub releases
ASSET_NAME="agentkernel-${OS}-${ARCH_LABEL}.tar.gz"
echo "Downloading prebuilt binary: $ASSET_NAME"
# Get latest release download URL
DOWNLOAD_URL="https://github.com/$REPO/releases/latest/download/$ASSET_NAME"
# Create install directory
mkdir -p "$INSTALL_DIR"
# Download and extract
TMPDIR="$(mktemp -d)"
trap 'rm -rf "$TMPDIR"' EXIT
if command -v curl &>/dev/null; then
curl -fsSL "$DOWNLOAD_URL" -o "$TMPDIR/$ASSET_NAME"
elif command -v wget &>/dev/null; then
wget -q "$DOWNLOAD_URL" -O "$TMPDIR/$ASSET_NAME"
else
echo "Error: Neither curl nor wget found."
exit 1
fi
tar xzf "$TMPDIR/$ASSET_NAME" -C "$TMPDIR"
# Find the binary (may be in a subdirectory)
BINARY="$(find "$TMPDIR" -name agentkernel -type f | head -1)"
if [ -z "$BINARY" ]; then
echo "Error: agentkernel binary not found in archive."
exit 1
fi
chmod +x "$BINARY"
mv "$BINARY" "$INSTALL_DIR/agentkernel"
echo ""
echo "=== Installation Complete ==="
echo ""
echo "Installed to: $INSTALL_DIR/agentkernel"
echo "Version: $("$INSTALL_DIR/agentkernel" --version 2>/dev/null || echo 'unknown')"
echo ""
# Check if install dir is in PATH
case ":$PATH:" in
*":$INSTALL_DIR:"*) ;;
*)
echo "NOTE: $INSTALL_DIR is not in your PATH."
echo "Add it with: export PATH=\"$INSTALL_DIR:\$PATH\""
echo ""
;;
esac
echo "Next step: Run 'agentkernel setup' to download required components."
echo ""