-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathinstall.sh
More file actions
82 lines (72 loc) · 2.19 KB
/
Copy pathinstall.sh
File metadata and controls
82 lines (72 loc) · 2.19 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
#!/bin/sh
set -eu
# agenttrace — single binary install (Rust + ratatui)
# Usage: curl -sL https://raw.githubusercontent.com/luoyuctl/agenttrace/master/install.sh | sh
REPO="luoyuctl/agenttrace"
BIN="agenttrace"
INSTALL_DIR="${AGENTTRACE_INSTALL_DIR:-}"
# — detect platform —
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case "$ARCH" in
x86_64|amd64) ARCH="amd64" ;;
aarch64|arm64) ARCH="arm64" ;;
armv7l) ARCH="armv7" ;;
*) echo "❌ Unsupported architecture: $ARCH"; exit 1 ;;
esac
case "$OS" in
linux|darwin) ;;
*) echo "❌ Unsupported OS: $OS"; exit 1 ;;
esac
# — resolve install directory —
if [ -n "$INSTALL_DIR" ]; then
:
elif [ "$OS" = "darwin" ]; then
INSTALL_DIR="${HOME}/.local/bin"
elif [ -w /usr/local/bin ]; then
INSTALL_DIR="/usr/local/bin"
elif [ -w "${HOME}/.local/bin" ] || [ -d "${HOME}/.local/bin" ]; then
INSTALL_DIR="${HOME}/.local/bin"
else
INSTALL_DIR="${HOME}/.local/bin"
fi
mkdir -p "$INSTALL_DIR"
DEST="${INSTALL_DIR}/${BIN}"
# — resolve latest release asset —
echo "🔍 Fetching latest release..."
ASSET="${BIN}-${OS}-${ARCH}"
RELEASE_URL="https://github.com/${REPO}/releases/latest/download/${ASSET}"
# — download —
echo "⬇️ Downloading agenttrace (${OS}/${ARCH})..."
TMP=$(mktemp)
if ! curl -fsSL -o "$TMP" "$RELEASE_URL"; then
rm -f "$TMP"
echo "❌ No binary found for ${OS}/${ARCH}"
echo " Build from source: git clone https://github.com/${REPO}.git && cd agenttrace && cargo build --release -p agenttrace"
exit 1
fi
chmod +x "$TMP"
# — size check —
SIZE=$(wc -c < "$TMP")
echo " Binary size: ${SIZE} bytes"
if [ "$SIZE" -lt 1000000 ]; then
rm -f "$TMP"
echo "❌ Downloaded file is too small to be the agenttrace binary."
exit 1
fi
# — install —
mv "$TMP" "$DEST"
echo "✅ Installed to ${DEST}"
# — PATH hint —
if ! echo "$PATH" | grep -q "$INSTALL_DIR"; then
echo ""
echo "⚠️ ${INSTALL_DIR} is not in your PATH."
echo " Add this to your shell profile:"
echo " export PATH=\"${INSTALL_DIR}:\$PATH\""
echo ""
fi
# — quick test —
echo ""
echo "🎉 agenttrace installed! Try:"
echo " agenttrace --latest"
echo " agenttrace # launch TUI"