#!/usr/bin/env bash # ssr-update — pull the latest ssr code from origin and refresh side-effects. # # Behavior: # 1. Verify the repo is a clean git checkout on a real branch. # 2. git fetch + fast-forward pull. Bail if FF would be impossible. # 3. Report VERSION delta. # 4. If the launchd template or any bin/ file changed and the schedule is # currently active, re-render and reload it. # 5. If config/ssr.conf.example gained new keys, warn the user. set -euo pipefail SSR_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # shellcheck source=../lib/common.sh source "$SSR_ROOT/lib/common.sh" DRY_RUN=false while [[ $# -gt 0 ]]; do case "$1" in -n|--dry-run) DRY_RUN=true; shift ;; -h|--help) cat </dev/null | grep -q "$label"; then ssr::log "launchd-relevant files changed → reloading schedule" "$SSR_ROOT/bin/ssr-schedule" on fi # --- 5. config drift hint ------------------------------------------------- example="$SSR_ROOT/config/ssr.conf.example" user_cfg="${SSR_CONFIG:-$HOME/.config/ssr/ssr.conf}" if [[ -f "$user_cfg" && -f "$example" ]]; then new_keys="$(comm -23 \ <(grep -E '^[A-Z_][A-Z0-9_]*=' "$example" | cut -d= -f1 | sort -u) \ <(grep -E '^[A-Z_][A-Z0-9_]*=' "$user_cfg" | cut -d= -f1 | sort -u))" if [[ -n "$new_keys" ]]; then ssr::warn "New config keys available in $example:" echo "$new_keys" | sed 's/^/ /' echo "Review with: ssr config edit" fi fi ssr::ok "Update complete."