omarchy-grok-usage/install.sh

28 lines
1 KiB
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
# Install the household Grok usage collector for the current user.
# Does not touch /usr/share/omarchy and does not install a bar plugin.
set -euo pipefail
root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
src="$root/src/omarchy_grok_usage.py"
bin_dir="${XDG_BIN_HOME:-$HOME/.local/bin}"
unit_dir="${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user"
if [[ ! -f "$src" ]]; then
echo "missing collector source: $src" >&2
exit 1
fi
mkdir -p "$bin_dir" "$unit_dir"
install -m 0755 "$src" "$bin_dir/omarchy-grok-usage"
install -m 0644 "$root/systemd/omarchy-grok-usage.service" "$unit_dir/omarchy-grok-usage.service"
install -m 0644 "$root/systemd/omarchy-grok-usage.timer" "$unit_dir/omarchy-grok-usage.timer"
systemctl --user daemon-reload
systemctl --user enable --now omarchy-grok-usage.timer
systemctl --user start omarchy-grok-usage.service
echo "Installed $bin_dir/omarchy-grok-usage"
echo "Timer: systemctl --user status omarchy-grok-usage.timer"
echo "If an official omarchy-agent-usage-grok later ships, this timer becomes a no-op."