fix: ship hermit-update (and hermit-service) as 1.0.1
ci / tcc-check (push) Failing after 42s
ci / linux (aarch64, 0) (push) Skipped
ci / linux (x86, 1) (push) Skipped
ci / linux (x86_64, 1) (push) Skipped
ci / windows (push) Skipped

Install hermit-update / hermit-service from make install and bootstrap;
keep cst-agent-* as compat symlinks.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
WHC
2026-10-29 22:00:07 +08:00
co-authored by Cursor
parent 41f4cf85ee
commit f29c1000b6
6 changed files with 83 additions and 31 deletions
+3 -2
View File
@@ -43,11 +43,12 @@ git clone https://git.whcself.xyz/WHC/CST-agent.git # 兼容;请改 origin
| 旧 | 新 | | 旧 | 新 |
|---|---| |---|---|
| `cst-agent` | `hermit`(安装时仍提供 `cst-agent` → `hermit` 软链) | | `cst-agent` | `hermit`(安装时仍提供 `cst-agent` → `hermit` 软链) |
| `cst-agent-update` | 仍可用;内部装的是 `hermit` | | `cst-agent-update` | → `hermit-update`(软链;议会助手 → `hermit-service`) |
| Release `cst-agent-VERSION-linux-*.tar.gz` | `hermit-VERSION-linux-*.tar.gz`(过渡期可能双发) | | Release `cst-agent-VERSION-linux-*.tar.gz` | `hermit-VERSION-linux-*.tar.gz`(过渡期可能双发) |
```bash ```bash
hermit --version # hermit 1.0.0 hermit --version # hermit 1.0.x
hermit-update # 升级;兼容名 cst-agent-update
cst-agent --version # 同二进制(软链) cst-agent --version # 同二进制(软链)
``` ```
+33
View File
@@ -323,11 +323,41 @@ clean:
rm -f $(OBJ) $(DEPFILES) hermit cst-agent $(CST_CORE_LIB) $(TESTS) \ rm -f $(OBJ) $(DEPFILES) hermit cst-agent $(CST_CORE_LIB) $(TESTS) \
.gen/models_builtin.inc .gen/web_assets.inc .gen/models_builtin.inc .gen/web_assets.inc
# Absolute checkout path for hermit-update (survives cd). Override with HERMIT_SRC.
HERMIT_SRC ?= $(abspath .)
install: hermit install: hermit
install -d "$(DESTDIR)$(PREFIX)/bin" install -d "$(DESTDIR)$(PREFIX)/bin"
install -m 0755 hermit "$(DESTDIR)$(PREFIX)/bin/hermit" install -m 0755 hermit "$(DESTDIR)$(PREFIX)/bin/hermit"
ln -sfr "$(DESTDIR)$(PREFIX)/bin/hermit" "$(DESTDIR)$(PREFIX)/bin/cst-agent" 2>/dev/null || \ ln -sfr "$(DESTDIR)$(PREFIX)/bin/hermit" "$(DESTDIR)$(PREFIX)/bin/cst-agent" 2>/dev/null || \
ln -sf hermit "$(DESTDIR)$(PREFIX)/bin/cst-agent" ln -sf hermit "$(DESTDIR)$(PREFIX)/bin/cst-agent"
@# hermit-update / hermit-service (cst-* compat symlinks)
@printf '%s\n' '#!/usr/bin/env bash' \
'export HERMIT_PREFIX="$${HERMIT_PREFIX:-$${CST_AGENT_PREFIX:-$(PREFIX)}}"' \
'export CST_AGENT_PREFIX="$$HERMIT_PREFIX"' \
'export HERMIT_DIR="$${HERMIT_DIR:-$${CST_AGENT_DIR:-$(HERMIT_SRC)}}"' \
'export CST_AGENT_DIR="$$HERMIT_DIR"' \
'exec bash "$$HERMIT_DIR/scripts/bootstrap_linux.sh" "$$HERMIT_DIR" "$$@"' \
> "$(DESTDIR)$(PREFIX)/bin/hermit-update"
@chmod 0755 "$(DESTDIR)$(PREFIX)/bin/hermit-update"
@ln -sfr "$(DESTDIR)$(PREFIX)/bin/hermit-update" "$(DESTDIR)$(PREFIX)/bin/cst-agent-update" 2>/dev/null || \
ln -sf hermit-update "$(DESTDIR)$(PREFIX)/bin/cst-agent-update"
@printf '%s\n' '#!/usr/bin/env bash' \
'set -euo pipefail' \
'BIN="$(PREFIX)/bin/hermit"' \
'cmd="$${1:-status}"' \
'case "$$cmd" in' \
'status) "$$BIN" --version; if command -v systemctl >/dev/null 2>&1 && systemctl --user is-active cst-agent-parliament.service >/dev/null 2>&1; then systemctl --user status cst-agent-parliament.service --no-pager; else "$$BIN" --service-stop >/dev/null 2>&1 || true; echo "parliament service: not managed by systemd --user"; fi ;;' \
'install-unit) make -C "$(HERMIT_SRC)" install-service PREFIX="$(PREFIX)" ;;' \
'start) systemctl --user start cst-agent-parliament.service ;;' \
'stop) systemctl --user stop cst-agent-parliament.service; "$$BIN" --service-stop || true ;;' \
'restart) systemctl --user restart cst-agent-parliament.service ;;' \
'*) echo "usage: hermit-service {status|install-unit|start|stop|restart}" >&2; exit 2 ;;' \
'esac' \
> "$(DESTDIR)$(PREFIX)/bin/hermit-service"
@chmod 0755 "$(DESTDIR)$(PREFIX)/bin/hermit-service"
@ln -sfr "$(DESTDIR)$(PREFIX)/bin/hermit-service" "$(DESTDIR)$(PREFIX)/bin/cst-agent-service" 2>/dev/null || \
ln -sf hermit-service "$(DESTDIR)$(PREFIX)/bin/cst-agent-service"
@if [ ! -f res/hermit-icons.ttf ]; then $(MAKE) hermit-font || true; fi @if [ ! -f res/hermit-icons.ttf ]; then $(MAKE) hermit-font || true; fi
@if [ -f res/hermit-icons.ttf ]; then \ @if [ -f res/hermit-icons.ttf ]; then \
install -d "$(DESTDIR)$(PREFIX)/share/hermit"; \ install -d "$(DESTDIR)$(PREFIX)/share/hermit"; \
@@ -347,6 +377,7 @@ install: hermit
install -d "$(DESTDIR)$(PREFIX)/share/hermit/frames"; \ install -d "$(DESTDIR)$(PREFIX)/share/hermit/frames"; \
cp -a res/hermit-frames/. "$(DESTDIR)$(PREFIX)/share/hermit/frames/"; \ cp -a res/hermit-frames/. "$(DESTDIR)$(PREFIX)/share/hermit/frames/"; \
fi fi
@echo "installed hermit-update → $(PREFIX)/bin/hermit-update"
# Optional systemd --user unit for the parliament seat service. # Optional systemd --user unit for the parliament seat service.
install-service: install install-service: install
@@ -361,6 +392,8 @@ install-service: install
uninstall: uninstall:
rm -f "$(DESTDIR)$(PREFIX)/bin/hermit" "$(DESTDIR)$(PREFIX)/bin/cst-agent" rm -f "$(DESTDIR)$(PREFIX)/bin/hermit" "$(DESTDIR)$(PREFIX)/bin/cst-agent"
rm -f "$(DESTDIR)$(PREFIX)/bin/hermit-update" "$(DESTDIR)$(PREFIX)/bin/cst-agent-update"
rm -f "$(DESTDIR)$(PREFIX)/bin/hermit-service" "$(DESTDIR)$(PREFIX)/bin/cst-agent-service"
rm -f "$(DESTDIR)$(PREFIX)/share/hermit/hermit-icons.ttf" rm -f "$(DESTDIR)$(PREFIX)/share/hermit/hermit-icons.ttf"
rm -f "$(DESTDIR)$(PREFIX)/share/fonts/hermit/hermit-icons.ttf" rm -f "$(DESTDIR)$(PREFIX)/share/fonts/hermit/hermit-icons.ttf"
rm -rf "$(DESTDIR)$(PREFIX)/share/hermit/frames" rm -rf "$(DESTDIR)$(PREFIX)/share/hermit/frames"
+2 -2
View File
@@ -30,8 +30,8 @@ curl -fsSL https://git.whcself.xyz/WHC/Hermit/raw/branch/main/scripts/bootstrap_
```bash ```bash
./scripts/bootstrap_linux.sh . ./scripts/bootstrap_linux.sh .
hermit --version # hermit 1.0.0 hermit --version # hermit 1.0.x
cst-agent-update # 升级助手仍可用 hermit-update # 升级(源码或 --release);兼容 cst-agent-update
./scripts/migrate_remote_to_hermit.sh # 已有 CST-agent 检出时改 origin ./scripts/migrate_remote_to_hermit.sh # 已有 CST-agent 检出时改 origin
``` ```
+1 -1
View File
@@ -3,7 +3,7 @@
#define CST_VERSION_MAJOR 1 #define CST_VERSION_MAJOR 1
#define CST_VERSION_MINOR 0 #define CST_VERSION_MINOR 0
#define CST_VERSION_PATCH 0 #define CST_VERSION_PATCH 1
#define CST_VERSION_STR_(x) #x #define CST_VERSION_STR_(x) #x
#define CST_VERSION_STR(x) CST_VERSION_STR_(x) #define CST_VERSION_STR(x) CST_VERSION_STR_(x)
+38 -22
View File
@@ -1,17 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Install or upgrade CST-Agent on Linux, WSL or macOS. Safe to rerun: an # Install or upgrade Hermit on Linux, WSL or macOS. Safe to rerun: an
# existing checkout is fast-forwarded, rebuilt and reinstalled. # existing checkout is fast-forwarded, rebuilt and reinstalled.
# #
# bootstrap_linux.sh [DIR] [--no-pull] [--release] [--source] # bootstrap_linux.sh [DIR] [--no-pull] [--release] [--source]
# cst-agent-update (installed by this script; same as rerunning it) # hermit-update (installed by this script; same as rerunning it)
# cst-agent-update (compat symlink → hermit-update)
# #
# --release downloads the static musl tarball for this host (fast; no compile). # --release downloads the static musl tarball for this host (fast; no compile).
# --source (default) builds from the checkout. CST_INSTALL_MODE=release|source # --source (default) builds from the checkout. CST_INSTALL_MODE=release|source
# overrides the flag. # overrides the flag.
# #
# Env: CST_AGENT_PREFIX (install prefix, default ~/.local), CST_AGENT_DIR # Env: HERMIT_PREFIX / CST_AGENT_PREFIX (install prefix, default ~/.local),
# (checkout, default: current checkout or ~/CST-agent), CST_AGENT_REPO, # HERMIT_DIR / CST_AGENT_DIR (checkout), HERMIT_REPO / CST_AGENT_REPO,
# CST_AGENT_VERSION (pin a release; default: cst_version.h or latest tag). # HERMIT_VERSION / CST_AGENT_VERSION (pin a release; default: cst_version.h).
set -euo pipefail set -euo pipefail
ROOT_HINT="$(cd "$(dirname "$0")/.." 2>/dev/null && pwd || true)" ROOT_HINT="$(cd "$(dirname "$0")/.." 2>/dev/null && pwd || true)"
@@ -80,15 +81,24 @@ install_font() {
install_helpers() { install_helpers() {
local prefix="$1" dir="$2" local prefix="$1" dir="$2"
local bash_bin
bash_bin="$(command -v bash)"
mkdir -p "$prefix/bin" mkdir -p "$prefix/bin"
cat >"$prefix/bin/cst-agent-update" <<EOF cat >"$prefix/bin/hermit-update" <<EOF
#!$(command -v bash) #!$bash_bin
export CST_AGENT_PREFIX="\${CST_AGENT_PREFIX:-$prefix}" # Upgrade Hermit (source build or --release tarball).
exec bash "$dir/scripts/bootstrap_linux.sh" "$dir" "\$@" export HERMIT_PREFIX="\${HERMIT_PREFIX:-\${CST_AGENT_PREFIX:-$prefix}}"
export CST_AGENT_PREFIX="\$HERMIT_PREFIX"
export HERMIT_DIR="\${HERMIT_DIR:-\${CST_AGENT_DIR:-$dir}}"
export CST_AGENT_DIR="\$HERMIT_DIR"
exec bash "$dir/scripts/bootstrap_linux.sh" "\$HERMIT_DIR" "\$@"
EOF EOF
chmod 0755 "$prefix/bin/cst-agent-update" chmod 0755 "$prefix/bin/hermit-update"
cat >"$prefix/bin/cst-agent-service" <<EOF ln -sfr "$prefix/bin/hermit-update" "$prefix/bin/cst-agent-update" 2>/dev/null || \
#!$(command -v bash) ln -sf hermit-update "$prefix/bin/cst-agent-update"
cat >"$prefix/bin/hermit-service" <<EOF
#!$bash_bin
# Manage the parliament seat service (foreground under systemd, or --service). # Manage the parliament seat service (foreground under systemd, or --service).
set -euo pipefail set -euo pipefail
BIN="$prefix/bin/hermit" BIN="$prefix/bin/hermit"
@@ -110,12 +120,14 @@ start) systemctl --user start cst-agent-parliament.service ;;
stop) systemctl --user stop cst-agent-parliament.service; "\$BIN" --service-stop || true ;; stop) systemctl --user stop cst-agent-parliament.service; "\$BIN" --service-stop || true ;;
restart) systemctl --user restart cst-agent-parliament.service ;; restart) systemctl --user restart cst-agent-parliament.service ;;
*) *)
echo "usage: cst-agent-service {status|install-unit|start|stop|restart}" >&2 echo "usage: hermit-service {status|install-unit|start|stop|restart}" >&2
exit 2 exit 2
;; ;;
esac esac
EOF EOF
chmod 0755 "$prefix/bin/cst-agent-service" chmod 0755 "$prefix/bin/hermit-service"
ln -sfr "$prefix/bin/hermit-service" "$prefix/bin/cst-agent-service" 2>/dev/null || \
ln -sf hermit-service "$prefix/bin/cst-agent-service"
} }
# Fast path: fetch static release tarball for this machine. # Fast path: fetch static release tarball for this machine.
@@ -129,7 +141,7 @@ install_from_release() {
echo "no prebuilt release for $(uname -m); use --source" >&2 echo "no prebuilt release for $(uname -m); use --source" >&2
return 1 return 1
} }
local ver="${CST_AGENT_VERSION:-}" local ver="${HERMIT_VERSION:-${CST_AGENT_VERSION:-}}"
if [[ -z "$ver" ]]; then if [[ -z "$ver" ]]; then
ver="$(cst_version)" ver="$(cst_version)"
fi fi
@@ -161,8 +173,8 @@ install_from_release() {
} }
main() { main() {
local repo_url="${CST_AGENT_REPO:-${HERMIT_REPO:-https://git.whcself.xyz/WHC/Hermit.git}}" local repo_url="${HERMIT_REPO:-${CST_AGENT_REPO:-https://git.whcself.xyz/WHC/Hermit.git}}"
local prefix="${CST_AGENT_PREFIX:-$HOME/.local}" local prefix="${HERMIT_PREFIX:-${CST_AGENT_PREFIX:-$HOME/.local}}"
local dir="" pull=1 changed=0 mode="${CST_INSTALL_MODE:-source}" arg local dir="" pull=1 changed=0 mode="${CST_INSTALL_MODE:-source}" arg
for arg in "$@"; do for arg in "$@"; do
case "$arg" in case "$arg" in
@@ -178,12 +190,16 @@ main() {
esac esac
done done
if [[ -z "$dir" ]]; then if [[ -z "$dir" ]]; then
if [[ -n "${CST_AGENT_DIR:-}" ]]; then if [[ -n "${HERMIT_DIR:-}" ]]; then
dir="$HERMIT_DIR"
elif [[ -n "${CST_AGENT_DIR:-}" ]]; then
dir="$CST_AGENT_DIR" dir="$CST_AGENT_DIR"
elif [[ -f Makefile && -f src/main.c && -d .git ]]; then elif [[ -f Makefile && -f src/main.c && -d .git ]]; then
dir="$(pwd)" dir="$(pwd)"
elif [[ -n "$ROOT_HINT" && -f "$ROOT_HINT/Makefile" ]]; then elif [[ -n "$ROOT_HINT" && -f "$ROOT_HINT/Makefile" ]]; then
dir="$ROOT_HINT" dir="$ROOT_HINT"
elif [[ -d "$HOME/Hermit/.git" ]]; then
dir="$HOME/Hermit"
else else
dir="$HOME/CST-agent" dir="$HOME/CST-agent"
fi fi
@@ -222,7 +238,7 @@ main() {
*":$prefix/bin:"*) ;; *":$prefix/bin:"*) ;;
*) echo "Add to PATH: export PATH=\"$prefix/bin:\$PATH\"" ;; *) echo "Add to PATH: export PATH=\"$prefix/bin:\$PATH\"" ;;
esac esac
echo "Upgrade: cst-agent-update --release Rebuild from source: --source" echo "Upgrade: hermit-update --release Rebuild from source: hermit-update --source"
return 0 return 0
fi fi
echo "==> continuing with source build" echo "==> continuing with source build"
@@ -257,9 +273,9 @@ main() {
*":$prefix/bin:"*) ;; *":$prefix/bin:"*) ;;
*) echo "Add to PATH: export PATH=\"$prefix/bin:\$PATH\"" ;; *) echo "Add to PATH: export PATH=\"$prefix/bin:\$PATH\"" ;;
esac esac
echo "Run 'hermit' (or 'cst-agent') in a project; upgrade with 'cst-agent-update'." echo "Run 'hermit' in a project; upgrade with 'hermit-update' (compat: cst-agent-update)."
echo "Fast upgrade from Release: 'cst-agent-update --release'." echo "Fast upgrade from Release: 'hermit-update --release'."
echo "Parliament helper: 'cst-agent-service status|install-unit'." echo "Parliament helper: 'hermit-service status|install-unit'."
echo "The first start asks for the provider and its API key and saves them." echo "The first start asks for the provider and its API key and saves them."
} }
+6 -4
View File
@@ -75,15 +75,17 @@ main() {
echo "==> install to $PREFIX/bin" echo "==> install to $PREFIX/bin"
make install make install
cat >"$PREFIX/bin/cst-agent-update" <<EOF cat >"$PREFIX/bin/hermit-update" <<EOF
#!$PREFIX/bin/bash #!$PREFIX/bin/bash
exec bash "$dir/scripts/bootstrap_termux.sh" "$dir" "\$@" exec bash "$dir/scripts/bootstrap_termux.sh" "$dir" "\$@"
EOF EOF
chmod 0755 "$PREFIX/bin/cst-agent-update" chmod 0755 "$PREFIX/bin/hermit-update"
ln -sfr "$PREFIX/bin/hermit-update" "$PREFIX/bin/cst-agent-update" 2>/dev/null || \
ln -sf hermit-update "$PREFIX/bin/cst-agent-update"
echo echo
echo "OK: $("$PREFIX/bin/cst-agent" --version)" echo "OK: $("$PREFIX/bin/hermit" --version 2>/dev/null || "$PREFIX/bin/cst-agent" --version)"
echo "Run 'cst-agent' inside a project directory; upgrade later with 'cst-agent-update'." echo "Run 'hermit' inside a project directory; upgrade later with 'hermit-update'."
echo "The first start asks for the provider and its API key and saves them." echo "The first start asks for the provider and its API key and saves them."
} }