▍ humdrum codex / ticktock v0.0.2
license AGPL-3.0
1.1 KB raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
# Repoint the com.humdrum.ticktock.autotrack launchd agent at `tt autotrack`.
#
# Rollback: the Python daemon in ticktock-old is untouched — re-run
#   ~/Developer/Home/ticktock-old/daemon/install-daemon.sh
# (note: it installs under the old com.ticktock.autotrack label; bootout the
# com.humdrum one first) or hand-edit the plist back to autotrack.py.
set -euo pipefail
REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
TT="$REPO/bin/tt"
LABEL="com.humdrum.ticktock.autotrack"
PLIST="${HOME}/Library/LaunchAgents/${LABEL}.plist"

[ -x "$TT" ] || { echo "missing $TT — run: make build helpers" >&2; exit 1; }
mkdir -p "${HOME}/.local/share/ticktock" "${HOME}/Library/LaunchAgents"

sed -e "s#@TT@#${TT}#g" -e "s#@HOME@#${HOME}#g" \
  "$REPO/deploy/autotrack.plist.template" > "$PLIST"

launchctl bootout "gui/$(id -u)/${LABEL}" 2>/dev/null || true
launchctl bootstrap "gui/$(id -u)" "$PLIST"
echo "✓ ${LABEL}${TT} autotrack  (${PLIST})"
echo "  verify: launchctl print gui/$(id -u)/${LABEL} | grep -E 'state|program'"
echo "  logs:   tail -f ~/.local/share/ticktock/autotrack.err"