Files
System-Sync-Restore/config/ssr.conf.example
T
Oliver Surke 5ed6279b51 Snapshot and restore macOS preference domains
Adds a round-trip mechanism for macOS system preferences that are not
covered by Homebrew or Mackup (Dock layout, Finder options, global
keyboard shortcuts, input sources, Spaces config, menu-bar clock,
NSGlobalDomain).

sync: `ssr sync` exports each configured domain with `defaults export`
and writes one plist per domain to <backup_dir>/macos-prefs/.  Export is
soft-fail per domain so one bad domain doesn't abort the sync. Gated by
SSR_SNAPSHOT_MACOS_PREFS=true (default on).

restore: `ssr restore` replays the snapshot with `defaults import` after
the declarative config/macos-defaults.sh runs, so the snapshot is the
last writer and wins for accepted domains.  Before importing, the restore
detects domains that both the snapshot and macos-defaults.sh touch and
prompts interactively:

  Domain `com.apple.dock`:
    Snapshot will OVERRIDE values set by macos-defaults.sh.
    [A]ccept snapshot / [r]eject (keep declarative)? [A/r]:

Non-TTY (launchd, CI) falls back to SSR_PREFS_CONFLICT_DEFAULT (default
"accept"). SSR_ASSUME_YES=true skips all prompts. After import, Dock,
Finder, SystemUIServer and cfprefsd are restarted once.

New config keys: SSR_SNAPSHOT_MACOS_PREFS, SSR_MACOS_PREF_DOMAINS,
SSR_MACOS_PREF_DOMAINS_EXTRA, SSR_PREFS_CONFLICT_DEFAULT, SSR_ASSUME_YES.

ssr-status surfaces the snapshotted-domain count.
README documents the snapshot flow, default domain table, conflict UX,
and the five new config keys.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-11 20:19:49 +02:00

81 lines
3.5 KiB
Plaintext

# ssr.conf — System Sync & Restore configuration.
# Format: simple KEY=VALUE pairs. Comments (# …) and blank lines allowed.
# This file is sourced by bash; only the keys below are recognized.
# Anything else will cause ssr to abort.
# ---------------------------------------------------------------------------
# Cloud storage
# ---------------------------------------------------------------------------
# Provider: icloud | dropbox | googledrive | onedrive | custom
SSR_CLOUD_PROVIDER=icloud
# Only used when SSR_CLOUD_PROVIDER=custom. Absolute path.
# SSR_CLOUD_PATH=/Volumes/MyNAS/macos-sync
# Subfolders created inside the cloud root.
SSR_BACKUP_SUBDIR=BACKUP
SSR_MACKUP_SUBDIR=Mackup
# ---------------------------------------------------------------------------
# Homebrew behavior during `ssr sync`
# ---------------------------------------------------------------------------
SSR_BREW_UPGRADE=true
SSR_BREW_CLEANUP=true
# ---------------------------------------------------------------------------
# Unmanaged-app scan during sync
# ---------------------------------------------------------------------------
# Lists .app bundles installed manually (not via brew cask, not via MAS).
# Writes <backup_dir>/unmanaged-apps.txt for restore-time reference.
SSR_SCAN_UNMANAGED_APPS=true
# Colon-separated directories to scan (top level only).
# SSR_APP_DIRS=/Applications:$HOME/Applications
# ---------------------------------------------------------------------------
# macOS preferences snapshot (sync + restore)
# ---------------------------------------------------------------------------
# Snapshot configured pref domains to <backup_dir>/macos-prefs/ during sync
# and replay them at the end of restore (after macos-defaults.sh).
SSR_SNAPSHOT_MACOS_PREFS=true
# Full override of the domain list (space-separated). Uncomment to replace
# the built-in default set.
# SSR_MACOS_PREF_DOMAINS="com.apple.dock com.apple.finder com.apple.symbolichotkeys com.apple.HIToolbox com.apple.spaces com.apple.menuextra.clock NSGlobalDomain"
# Append extra domains to the default set without replacing it.
# SSR_MACOS_PREF_DOMAINS_EXTRA="com.apple.universalaccess com.apple.Spotlight"
# How to resolve conflicts when restore is non-interactive (no TTY, launchd).
# "accept" = snapshot wins; "reject" = declarative macos-defaults.sh wins.
SSR_PREFS_CONFLICT_DEFAULT=accept
# Set to "true" to skip all conflict prompts and auto-accept everywhere.
# SSR_ASSUME_YES=false
# ---------------------------------------------------------------------------
# macOS restore behavior
# ---------------------------------------------------------------------------
# Disabling Gatekeeper allows apps from anywhere. Off by default.
SSR_DISABLE_GATEKEEPER=false
# Open every installed cask once after restore (for first-run config).
SSR_OPEN_CASKS=false
# Path to the macOS defaults script applied at the end of `ssr restore`.
# Leave commented to use the repo default (config/macos-defaults.sh).
# SSR_MACOS_DEFAULTS=/path/to/your/macos-defaults.sh
# ---------------------------------------------------------------------------
# Scheduling
# ---------------------------------------------------------------------------
SSR_LAUNCHD_LABEL=de.surke.ssr.sync
SSR_SCHEDULE_HOUR=9
SSR_SCHEDULE_MINUTE=0
# ---------------------------------------------------------------------------
# Paths
# ---------------------------------------------------------------------------
# SSR_STATE_DIR=$HOME/.local/state/ssr
# SSR_LOG_DIR=$HOME/.local/state/ssr/logs