todo-app/mcp/install.sh
Krzysztof kuhy Rudnicki 2a9332094a
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
file-length / file length <= 250 lines (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
MCP: Dart task server replaces Python todo_mcp
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-02 09:36:44 +01:00

28 lines
855 B
Bash
Executable File

#!/bin/bash
# Deploy: frozen binary + systemd --user unit; restarts the unit if running.
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
readonly ROOT
readonly BIN_DIR="${HOME}/.local/lib/todo-mcp"
readonly UNIT_DIR="${HOME}/.config/systemd/user"
readonly UNIT="todo-mcp.service"
main() {
mkdir -p "$BIN_DIR" "$UNIT_DIR"
(cd "$ROOT" && flutter pub get >/dev/null)
(cd "$ROOT" && dart compile exe mcp/todo_mcp.dart -o "$BIN_DIR/todo_mcp.new")
mv "$BIN_DIR/todo_mcp.new" "$BIN_DIR/todo_mcp"
install -m 644 "$ROOT/mcp/$UNIT" "$UNIT_DIR/$UNIT"
systemctl --user daemon-reload
if systemctl --user is-active --quiet "$UNIT"; then
systemctl --user restart "$UNIT"
echo "restarted $UNIT"
else
echo "installed; start with: systemctl --user enable --now $UNIT"
fi
}
main "$@"