-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·48 lines (41 loc) · 1.41 KB
/
setup.sh
File metadata and controls
executable file
·48 lines (41 loc) · 1.41 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
#!/usr/bin/env bash
# One-line installer for agent-status-tmux
# Usage: curl -fsSL https://raw.githubusercontent.com/jimmyliao/agent-status-tmux/main/setup.sh | bash
set -euo pipefail
REPO="jimmyliao/agent-status-tmux"
INSTALL_DIR="${AGENT_STATUS_TMUX_DIR:-$HOME/.agent-status-tmux}"
info() { echo " [+] $*"; }
ok() { echo " [OK] $*"; }
err() { echo " [x] $*" >&2; }
echo "=== agent-status-tmux setup ==="
echo ""
# Check dependencies
for cmd in jq tmux; do
if ! command -v "$cmd" &>/dev/null; then
err "$cmd is required. Install it first (e.g., brew install $cmd)"
exit 1
fi
done
# Download and extract
if command -v git &>/dev/null; then
# Prefer git clone for easier updates
if [[ -d "$INSTALL_DIR/.git" ]]; then
info "Updating existing install at $INSTALL_DIR"
git -C "$INSTALL_DIR" pull --ff-only 2>/dev/null || true
else
info "Cloning to $INSTALL_DIR"
rm -rf "$INSTALL_DIR"
git clone --depth 1 "https://github.com/$REPO.git" "$INSTALL_DIR"
fi
else
# No git — download tarball
info "Downloading to $INSTALL_DIR (no git found, using tarball)"
rm -rf "$INSTALL_DIR"
mkdir -p "$INSTALL_DIR"
curl -fsSL "https://github.com/$REPO/archive/refs/heads/main.tar.gz" \
| tar xz --strip-components=1 -C "$INSTALL_DIR"
fi
ok "Downloaded to $INSTALL_DIR"
# Make scripts executable and run installer
chmod +x "$INSTALL_DIR/scripts/"*.sh
exec "$INSTALL_DIR/scripts/install.sh"