55# Run with: curl -fsSL https://raw.githubusercontent.com/thrashr888/agentkernel/main/install.sh | sh
66#
77# After installation, run: agentkernel setup
8+ #
9+ # Environment variables:
10+ # INSTALL_DIR - Where to install the binary (default: ~/.local/bin)
11+ # USE_CARGO=1 - Force building from source via cargo instead of downloading
812
913set -euo pipefail
1014
@@ -19,38 +23,82 @@ OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
1923ARCH=" $( uname -m) "
2024
2125case " $ARCH " in
22- x86_64) ARCH= " x86_64 " ;;
23- aarch64|arm64) ARCH= " aarch64 " ;;
26+ x86_64) ARCH_LABEL= " x64 " ;;
27+ aarch64|arm64) ARCH_LABEL= " arm64 " ;;
2428 * )
2529 echo " Error: Unsupported architecture: $ARCH "
2630 exit 1
2731 ;;
2832esac
2933
30- echo " Detected: $OS /$ARCH "
34+ echo " Detected: $OS /$ARCH_LABEL "
3135
32- # Check for Rust/Cargo (required for now since we don't have prebuilt binaries)
33- if command -v cargo & > /dev/null; then
36+ # Force cargo build if requested
37+ if [ " ${USE_CARGO:- } " = " 1" ]; then
38+ if ! command -v cargo & > /dev/null; then
39+ echo " Error: USE_CARGO=1 but cargo not found."
40+ exit 1
41+ fi
3442 echo " "
35- echo " Installing via Cargo..."
36- cargo install --git " https://github.com/$REPO " agentkernel
37-
43+ echo " Installing via Cargo (forced)..."
44+ cargo install --git " https://github.com/$REPO " agentkernel --force
3845 echo " "
3946 echo " === Installation Complete ==="
40- echo " "
4147 echo " Next step: Run 'agentkernel setup' to download required components."
42- echo " "
4348 exit 0
4449fi
4550
46- # No Cargo - try to download prebuilt binary (not available yet)
51+ # Download prebuilt binary from GitHub releases
52+ ASSET_NAME=" agentkernel-${OS} -${ARCH_LABEL} .tar.gz"
53+ echo " Downloading prebuilt binary: $ASSET_NAME "
54+
55+ # Get latest release download URL
56+ DOWNLOAD_URL=" https://github.com/$REPO /releases/latest/download/$ASSET_NAME "
57+
58+ # Create install directory
59+ mkdir -p " $INSTALL_DIR "
60+
61+ # Download and extract
62+ TMPDIR=" $( mktemp -d) "
63+ trap ' rm -rf "$TMPDIR"' EXIT
64+
65+ if command -v curl & > /dev/null; then
66+ curl -fsSL " $DOWNLOAD_URL " -o " $TMPDIR /$ASSET_NAME "
67+ elif command -v wget & > /dev/null; then
68+ wget -q " $DOWNLOAD_URL " -O " $TMPDIR /$ASSET_NAME "
69+ else
70+ echo " Error: Neither curl nor wget found."
71+ exit 1
72+ fi
73+
74+ tar xzf " $TMPDIR /$ASSET_NAME " -C " $TMPDIR "
75+
76+ # Find the binary (may be in a subdirectory)
77+ BINARY=" $( find " $TMPDIR " -name agentkernel -type f | head -1) "
78+ if [ -z " $BINARY " ]; then
79+ echo " Error: agentkernel binary not found in archive."
80+ exit 1
81+ fi
82+
83+ chmod +x " $BINARY "
84+ mv " $BINARY " " $INSTALL_DIR /agentkernel"
85+
4786echo " "
48- echo " Error: Rust/Cargo not found. "
87+ echo " === Installation Complete === "
4988echo " "
50- echo " Install Rust first: "
51- echo " curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh "
89+ echo " Installed to: $INSTALL_DIR /agentkernel "
90+ echo " Version: $( " $INSTALL_DIR /agentkernel " --version 2> /dev/null || echo ' unknown ' ) "
5291echo " "
53- echo " Then run this installer again, or install directly with:"
54- echo " cargo install --git https://github.com/$REPO agentkernel"
92+
93+ # Check if install dir is in PATH
94+ case " :$PATH :" in
95+ * " :$INSTALL_DIR :" * ) ;;
96+ * )
97+ echo " NOTE: $INSTALL_DIR is not in your PATH."
98+ echo " Add it with: export PATH=\" $INSTALL_DIR :\$ PATH\" "
99+ echo " "
100+ ;;
101+ esac
102+
103+ echo " Next step: Run 'agentkernel setup' to download required components."
55104echo " "
56- exit 1
0 commit comments