Skip to content
This repository was archived by the owner on May 6, 2026. It is now read-only.

Commit f2b8e76

Browse files
author
yysjasmine
committed
Improve Linux installer entrypoints
1 parent d96af93 commit f2b8e76

3 files changed

Lines changed: 285 additions & 39 deletions

File tree

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Pre-built installers live on the [GitHub Releases page](https://github.com/Sense
9191
|----------|----------|------------|
9292
| Windows | [Grab the `-windows-x64.exe` from the latest release](https://github.com/SenseTime-FVG/agent_pack/releases/latest) | Double-click and follow the wizard; installation runs inside WSL2, and the PowerShell window is taken over by the installed agent when setup finishes |
9393
| macOS | [Grab the `-macos-universal.pkg` from the latest release](https://github.com/SenseTime-FVG/agent_pack/releases/latest) | Double-click, then complete setup in the macOS wizard for product selection and LLM configuration; when setup finishes it opens the selected OpenClaw Gateway Terminal plus dashboard, and the Hermes Terminal when chosen |
94-
| Linux | [Grab the `-linux.sh` from the latest release](https://github.com/SenseTime-FVG/agent_pack/releases/latest) *or* the one-liner below | Download and run `chmod +x AgentPack-*-linux.sh && ./AgentPack-*-linux.sh`, or paste `curl -fsSL https://raw.githubusercontent.com/SenseTime-FVG/agent_pack/main/linux/install.sh \| bash` — either way the shell that ran the installer is handed over to the agent via `exec` |
94+
| Linux | [Grab the `-linux.sh` from the latest release](https://github.com/SenseTime-FVG/agent_pack/releases/latest) *or* the one-liner below | Download and run `chmod +x AgentPack-*-linux.sh && ./AgentPack-*-linux.sh`, or paste `bash <(curl -fsSL https://raw.githubusercontent.com/SenseTime-FVG/agent_pack/main/linux/install.sh)` — either way the shell that ran the installer is handed over to the agent via `exec` |
9595

9696
## Building from Source
9797

@@ -122,7 +122,17 @@ Output: `dist/AgentPack-<ver>-macos-universal.pkg`
122122
No build step needed. Distribute `linux/install.sh` and `linux/lib/` together, or host the full repo and use:
123123

124124
```bash
125-
curl -fsSL https://raw.githubusercontent.com/SenseTime-FVG/agent_pack/main/linux/install.sh | bash
125+
bash <(curl -fsSL https://raw.githubusercontent.com/SenseTime-FVG/agent_pack/main/linux/install.sh)
126+
```
127+
128+
For unattended installs, pass `--yes` plus any config overrides you want:
129+
130+
```bash
131+
bash <(curl -fsSL https://raw.githubusercontent.com/SenseTime-FVG/agent_pack/main/linux/install.sh) \
132+
--yes \
133+
--product hermes \
134+
--provider openrouter \
135+
--api-key sk-...
126136
```
127137

128138
## Configuration

linux/install.sh

Lines changed: 200 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ set -euo pipefail
1212
# no LLM config written. Rebind stdin to the controlling tty so prompts
1313
# work in that flow. No-op when stdin is already a tty (plain `bash
1414
# install.sh`) or when there's no tty to fall back to (CI, containers).
15-
if [ ! -t 0 ] && [ -r /dev/tty ]; then
16-
exec </dev/tty
17-
fi
18-
1915
INSTALLER_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2016
LIB_DIR="$INSTALLER_DIR/lib"
2117
AGENT_PACK_CLONE_ROOT=""
2218
AGENT_PACK_TEMP_ROOT=""
19+
INTERACTIVE_MODE=1
20+
LAUNCH_AFTER_INSTALL=-1
21+
PRESET_LLM_CONFIG=0
22+
PRODUCT_SELECTION="${PRODUCT_SELECTION:-}"
2323

2424
_ap_cleanup() {
2525
if [ -n "$AGENT_PACK_TEMP_ROOT" ] && [ -d "$AGENT_PACK_TEMP_ROOT" ]; then
@@ -29,7 +29,162 @@ _ap_cleanup() {
2929

3030
trap _ap_cleanup EXIT
3131

32-
# If running via curl | bash, download the full package first.
32+
_ap_usage() {
33+
cat <<'EOF'
34+
Usage: bash install.sh [options]
35+
36+
Interactive install:
37+
bash <(curl -fsSL https://raw.githubusercontent.com/SenseTime-FVG/agent_pack/main/linux/install.sh)
38+
39+
Non-interactive install:
40+
bash <(curl -fsSL https://raw.githubusercontent.com/SenseTime-FVG/agent_pack/main/linux/install.sh) \
41+
--yes --product hermes --provider openrouter --api-key sk-...
42+
43+
Options:
44+
-h, --help Show this help message
45+
-y, --yes, --non-interactive
46+
Disable prompts; default product is hermes
47+
--product VALUE hermes | openclaw | both
48+
--provider VALUE openrouter | openai | anthropic | custom
49+
--base-url URL Base URL for the selected provider
50+
--model MODEL Model ID to write into product config
51+
--api-key KEY API key to write into product config
52+
--skip-llm-config Skip writing LLM credentials/config
53+
--launch Launch installed product(s) at the end
54+
--no-launch Do not launch installed product(s) at the end
55+
EOF
56+
}
57+
58+
_ap_require_arg() {
59+
local flag="$1"
60+
local value="${2-}"
61+
if [ -z "$value" ]; then
62+
echo "[!] Missing value for $flag." >&2
63+
exit 1
64+
fi
65+
}
66+
67+
_ap_parse_args() {
68+
while [ "$#" -gt 0 ]; do
69+
case "$1" in
70+
-h|--help)
71+
_ap_usage
72+
exit 0
73+
;;
74+
-y|--yes|--non-interactive)
75+
INTERACTIVE_MODE=0
76+
;;
77+
--launch)
78+
LAUNCH_AFTER_INSTALL=1
79+
;;
80+
--no-launch)
81+
LAUNCH_AFTER_INSTALL=0
82+
;;
83+
--product)
84+
_ap_require_arg "$1" "${2-}"
85+
PRODUCT_SELECTION="$2"
86+
shift
87+
;;
88+
--product=*)
89+
PRODUCT_SELECTION="${1#*=}"
90+
;;
91+
--provider)
92+
_ap_require_arg "$1" "${2-}"
93+
LLM_PROVIDER="$(printf '%s' "$2" | tr '[:upper:]' '[:lower:]')"
94+
PRESET_LLM_CONFIG=1
95+
shift
96+
;;
97+
--provider=*)
98+
LLM_PROVIDER="$(printf '%s' "${1#*=}" | tr '[:upper:]' '[:lower:]')"
99+
PRESET_LLM_CONFIG=1
100+
;;
101+
--base-url)
102+
_ap_require_arg "$1" "${2-}"
103+
LLM_BASE_URL="$2"
104+
PRESET_LLM_CONFIG=1
105+
shift
106+
;;
107+
--base-url=*)
108+
LLM_BASE_URL="${1#*=}"
109+
PRESET_LLM_CONFIG=1
110+
;;
111+
--model)
112+
_ap_require_arg "$1" "${2-}"
113+
LLM_MODEL="$2"
114+
PRESET_LLM_CONFIG=1
115+
shift
116+
;;
117+
--model=*)
118+
LLM_MODEL="${1#*=}"
119+
PRESET_LLM_CONFIG=1
120+
;;
121+
--api-key)
122+
_ap_require_arg "$1" "${2-}"
123+
LLM_API_KEY="$2"
124+
PRESET_LLM_CONFIG=1
125+
shift
126+
;;
127+
--api-key=*)
128+
LLM_API_KEY="${1#*=}"
129+
PRESET_LLM_CONFIG=1
130+
;;
131+
--skip-llm-config)
132+
LLM_PROVIDER=""
133+
LLM_BASE_URL=""
134+
LLM_MODEL=""
135+
LLM_API_KEY=""
136+
PRESET_LLM_CONFIG=1
137+
;;
138+
*)
139+
echo "[!] Unknown option: $1" >&2
140+
echo "" >&2
141+
_ap_usage >&2
142+
exit 1
143+
;;
144+
esac
145+
shift
146+
done
147+
}
148+
149+
_ap_set_selected_products() {
150+
local choice
151+
choice="$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]')"
152+
case "$choice" in
153+
1|hermes)
154+
SELECTED_PRODUCTS=("hermes")
155+
;;
156+
2|openclaw)
157+
SELECTED_PRODUCTS=("openclaw")
158+
;;
159+
3|both)
160+
SELECTED_PRODUCTS=("hermes" "openclaw")
161+
;;
162+
*)
163+
return 1
164+
;;
165+
esac
166+
}
167+
168+
_ap_parse_args "$@"
169+
170+
if [ "$LAUNCH_AFTER_INSTALL" -lt 0 ]; then
171+
if [ "$INTERACTIVE_MODE" -eq 1 ]; then
172+
LAUNCH_AFTER_INSTALL=1
173+
else
174+
LAUNCH_AFTER_INSTALL=0
175+
fi
176+
fi
177+
178+
if [ "$INTERACTIVE_MODE" -eq 1 ] && [ ! -t 0 ]; then
179+
echo "[!] Interactive install needs a terminal for prompts." >&2
180+
echo " Use:" >&2
181+
echo " bash <(curl -fsSL https://raw.githubusercontent.com/SenseTime-FVG/agent_pack/main/linux/install.sh)" >&2
182+
echo " Or run unattended with:" >&2
183+
echo " bash <(curl -fsSL https://raw.githubusercontent.com/SenseTime-FVG/agent_pack/main/linux/install.sh) --yes [options]" >&2
184+
exit 1
185+
fi
186+
187+
# If running from a one-liner bootstrap, download the full package first.
33188
# This bootstrap can't read config/defaults.json yet (we haven't fetched it),
34189
# so the repo URL + CN mirrors are duplicated here as a minimal bootstrap.
35190
# Keep the mirror list in sync with config/defaults.json (agent_pack.cn_mirrors).
@@ -69,6 +224,10 @@ source "$LIB_DIR/install-hermes.sh"
69224
source "$LIB_DIR/install-openclaw.sh"
70225
source "$LIB_DIR/configure-llm.sh"
71226

227+
if [ "$PRESET_LLM_CONFIG" -eq 0 ] && [ -n "$LLM_PROVIDER$LLM_BASE_URL$LLM_MODEL$LLM_API_KEY" ]; then
228+
PRESET_LLM_CONFIG=1
229+
fi
230+
72231
# CN-region environment setup: mirror env vars + TUNA apt + pre-installed uv.
73232
# Driven by AGENTPACK_CN=1 or a CN network probe inside cn-env.sh's caller.
74233
_AP_SHARED_DIR="$(cd "$INSTALLER_DIR/../shared" && pwd)"
@@ -116,27 +275,40 @@ echo ""
116275
# ---- Step 1: Collect LLM Configuration ----
117276
# Ask up front (mirrors the Windows installer wizard) so the user is done
118277
# with interactive prompts before the long-running installs start.
119-
collect_llm_config
120-
verify_llm_config_interactive || exit 1
278+
if [ "$INTERACTIVE_MODE" -eq 1 ] && [ "$PRESET_LLM_CONFIG" -eq 0 ]; then
279+
collect_llm_config
280+
else
281+
prepare_llm_config_noninteractive || exit 1
282+
fi
283+
if [ "$INTERACTIVE_MODE" -eq 1 ]; then
284+
verify_llm_config_interactive || exit 1
285+
fi
121286

122287
# ---- Step 2: Product Selection ----
123288
SELECTED_PRODUCTS=()
124-
while true; do
125-
echo ""
126-
echo "Which products would you like to install?"
127-
echo " 1) Hermes Agent"
128-
echo " 2) OpenClaw"
129-
echo " 3) Both"
130-
echo ""
131-
read -rp "Choice [1/2/3]: " product_choice
132-
133-
case "$product_choice" in
134-
1) SELECTED_PRODUCTS=("hermes") ; break ;;
135-
2) SELECTED_PRODUCTS=("openclaw") ; break ;;
136-
3) SELECTED_PRODUCTS=("hermes" "openclaw") ; break ;;
137-
*) echo "Please choose 1, 2, or 3." ;;
138-
esac
139-
done
289+
if [ -n "$PRODUCT_SELECTION" ]; then
290+
if ! _ap_set_selected_products "$PRODUCT_SELECTION"; then
291+
echo "[!] Invalid --product value '$PRODUCT_SELECTION'. Use hermes, openclaw, or both." >&2
292+
exit 1
293+
fi
294+
elif [ "$INTERACTIVE_MODE" -eq 1 ]; then
295+
while true; do
296+
echo ""
297+
echo "Which products would you like to install?"
298+
echo " 1) Hermes Agent"
299+
echo " 2) OpenClaw"
300+
echo " 3) Both"
301+
echo ""
302+
read -rp "Choice [1/2/3]: " product_choice
303+
304+
if _ap_set_selected_products "$product_choice"; then
305+
break
306+
fi
307+
echo "Please choose 1, 2, or 3."
308+
done
309+
else
310+
_ap_set_selected_products "hermes"
311+
fi
140312

141313
echo ""
142314
echo "Selected: ${SELECTED_PRODUCTS[*]}"
@@ -171,6 +343,11 @@ echo ""
171343
echo " You may need to restart your shell or run: source ~/.bashrc"
172344
echo ""
173345

346+
if [ "$LAUNCH_AFTER_INSTALL" -ne 1 ]; then
347+
echo "[*] Install finished without launching agent processes."
348+
exit 0
349+
fi
350+
174351
# ---- Step 4: Launch Installed Products In This Window ----
175352
# Take over this install session with the selected agent(s). When both are
176353
# selected, background `openclaw gateway` (logs to ~/.openclaw/gateway.log)

0 commit comments

Comments
 (0)