-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathget-eva.sh
More file actions
212 lines (190 loc) · 7.22 KB
/
Copy pathget-eva.sh
File metadata and controls
212 lines (190 loc) · 7.22 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#!/usr/bin/env bash
# ============================================================================
# Eva AI Assistant — remote installer
#
# curl -fsSL https://appatalks.github.io/eva-agent/install.sh | bash
#
# What it does:
# 1. Checks for git, python3, node (installs if missing and user confirms)
# 2. Clones the repo to ~/.eva (or updates if it exists)
# 3. Runs the local install.sh to set up all dependencies
# 4. Builds the standalone AppImage
# 5. Creates a symlink so `eva` works from anywhere
#
# Options (passed as env vars before the pipe):
# EVA_DIR=~/my-eva — install location (default: ~/.eva)
# EVA_YES=1 — skip all prompts
# EVA_CHECK=1 — report only, don't install
# EVA_NO_BUILD=1 — skip AppImage build
# ============================================================================
set -euo pipefail
EVA_DIR="${EVA_DIR:-$HOME/.eva}"
EVA_YES="${EVA_YES:-0}"
EVA_CHECK="${EVA_CHECK:-0}"
EVA_NO_BUILD="${EVA_NO_BUILD:-0}"
EVA_REPO="https://github.com/appatalks/eva-agent.git"
EVA_BIN="$HOME/.local/bin"
# Colors
if [ -t 1 ]; then
R=$'\033[0;31m'; G=$'\033[0;32m'; Y=$'\033[1;33m'
C=$'\033[0;36m'; B=$'\033[1m'; N=$'\033[0m'
else
R=""; G=""; Y=""; C=""; B=""; N=""
fi
info() { printf '%s[eva]%s %s\n' "$C" "$N" "$*"; }
ok() { printf '%s[eva]%s %s\n' "$G" "$N" "$*"; }
warn() { printf '%s[eva]%s %s\n' "$Y" "$N" "$*"; }
fail() { printf '%s[eva]%s %s\n' "$R" "$N" "$*"; exit 1; }
confirm() {
[ "$EVA_YES" = "1" ] && return 0
printf '%s[eva]%s %s [Y/n] ' "$Y" "$N" "$1"
read -r ans
case "$ans" in
[Nn]*) return 1 ;;
*) return 0 ;;
esac
}
# ── Platform detection ──────────────────────────────────────────────────────
OS="$(uname -s)"
ARCH="$(uname -m)"
case "$OS" in
Linux) PLATFORM="linux" ;;
Darwin) PLATFORM="macos" ;;
*) fail "Unsupported OS: $OS. Eva supports Linux and macOS." ;;
esac
info "Eva AI Assistant installer"
info "Platform: $PLATFORM ($ARCH)"
info "Install directory: $EVA_DIR"
echo
# ── Check / install prerequisites ──────────────────────────────────────────
check_cmd() {
command -v "$1" >/dev/null 2>&1
}
install_prereq() {
local cmd="$1" pkg="$2"
if check_cmd "$cmd"; then
ok "$cmd found: $(command -v "$cmd")"
return 0
fi
warn "$cmd not found."
if [ "$EVA_CHECK" = "1" ]; then return 1; fi
if [ "$PLATFORM" = "linux" ]; then
if check_cmd apt-get; then
confirm "Install $pkg via apt?" && sudo apt-get update -qq && sudo apt-get install -y -qq "$pkg"
elif check_cmd dnf; then
confirm "Install $pkg via dnf?" && sudo dnf install -y "$pkg"
elif check_cmd pacman; then
confirm "Install $pkg via pacman?" && sudo pacman -S --noconfirm "$pkg"
else
fail "No supported package manager found. Install $cmd manually."
fi
elif [ "$PLATFORM" = "macos" ]; then
if ! check_cmd brew; then
confirm "Install Homebrew first?" && /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
confirm "Install $pkg via brew?" && brew install "$pkg"
fi
check_cmd "$cmd" || fail "Failed to install $cmd."
ok "$cmd installed."
}
install_prereq git git
install_prereq python3 python3
install_prereq node nodejs
# Node version check
NODE_MAJOR="$(node --version 2>/dev/null | sed 's/v//' | cut -d. -f1)"
if [ -n "$NODE_MAJOR" ] && [ "$NODE_MAJOR" -lt 24 ]; then
warn "Node.js $NODE_MAJOR found, but Eva needs 24+."
if [ "$PLATFORM" = "linux" ] && [ "$EVA_CHECK" != "1" ]; then
if confirm "Install Node.js 24 via NodeSource?"; then
curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -
sudo apt-get install -y nodejs
ok "Node.js $(node --version) installed."
fi
elif [ "$PLATFORM" = "macos" ] && [ "$EVA_CHECK" != "1" ]; then
confirm "Upgrade node via brew?" && brew install node@24
fi
fi
echo
if [ "$EVA_CHECK" = "1" ]; then
info "Check mode: no changes made."
exit 0
fi
# ── Clone or update ────────────────────────────────────────────────────────
if [ -d "$EVA_DIR/.git" ]; then
info "Updating existing installation..."
cd "$EVA_DIR"
git pull --ff-only origin main || warn "Pull failed; continuing with current version."
else
info "Cloning Eva..."
git clone --depth 1 "$EVA_REPO" "$EVA_DIR"
cd "$EVA_DIR"
fi
# ── Run local installer ───────────────────────────────────────────────────
if [ -f install.sh ]; then
info "Running dependency installer..."
INSTALL_ARGS="--yes"
if [ "$EVA_NO_BUILD" != "1" ]; then
INSTALL_ARGS="$INSTALL_ARGS --build"
fi
bash install.sh $INSTALL_ARGS
fi
# ── Create launcher ───────────────────────────────────────────────────────
LINUX_INTEGRATION="$EVA_DIR/standalone/linux-integration.sh"
[ -f "$LINUX_INTEGRATION" ] || fail "Missing standalone/linux-integration.sh"
# shellcheck source=standalone/linux-integration.sh
. "$LINUX_INTEGRATION"
mkdir -p "$EVA_BIN"
APPIMAGE="$(eva_appimage_find_newest "$EVA_DIR/standalone/dist" || true)"
rm -f "$EVA_BIN/eva"
# linux-integration.sh adds --eva-workspace-terminal-v1 to the stable launcher.
if [ -n "$APPIMAGE" ] && eva_refresh_system_integration "$EVA_DIR"; then
ok "Created workspace-enabled launcher: eva -> current AppImage"
else
# Fallback: create a launcher script that starts the bridge + opens browser
cat > "$EVA_BIN/eva" <<'LAUNCHER'
#!/usr/bin/env bash
EVA_HOME="${EVA_HOME:-$HOME/.eva}"
cd "$EVA_HOME" || { echo "Eva not found at $EVA_HOME"; exit 1; }
echo "Starting Eva bridge on http://localhost:8888..."
python3 tools/acp_bridge.py &
BRIDGE_PID=$!
sleep 2
if command -v xdg-open >/dev/null 2>&1; then
xdg-open "http://localhost:8888" 2>/dev/null || true
elif command -v open >/dev/null 2>&1; then
open "http://localhost:8888" || true
fi
echo "Eva bridge running (PID $BRIDGE_PID). Press Ctrl+C to stop."
wait $BRIDGE_PID
LAUNCHER
chmod +x "$EVA_BIN/eva"
ok "Created launcher: $EVA_BIN/eva"
eva_write_desktop_entry "$HOME/.local/share/applications/eva.desktop" \
"$EVA_BIN/eva" "$EVA_DIR/core/img/eva-icon.svg"
ok "Desktop entry: $HOME/.local/share/applications/eva.desktop"
fi
# Ensure ~/.local/bin is on PATH
case ":$PATH:" in
*":$EVA_BIN:"*) ;;
*)
SHELL_RC=""
if [ -f "$HOME/.bashrc" ]; then SHELL_RC="$HOME/.bashrc"
elif [ -f "$HOME/.zshrc" ]; then SHELL_RC="$HOME/.zshrc"
fi
if [ -n "$SHELL_RC" ]; then
if ! grep -q 'local/bin' "$SHELL_RC" 2>/dev/null; then
echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$SHELL_RC"
info "Added ~/.local/bin to PATH in $SHELL_RC"
fi
fi
export PATH="$EVA_BIN:$PATH"
;;
esac
echo
echo "${B}Eva is installed.${N}"
echo
echo " Run: ${G}eva${N}"
echo
echo " Update: ${C}cd $EVA_DIR && git pull && ./install.sh --build${N}"
echo " Docs: ${C}https://appatalks.github.io/eva-agent/${N}"
echo