Initial ssr repository

Convert the legacy system_sync.sh and system_restore.sh into a modular
shareable repository:

- bin/ssr CLI dispatcher with install/sync/restore/schedule/config/status
- lib/ split: common, cloud, brew, mackup, macos
- Cloud provider abstraction (icloud, dropbox, googledrive, onedrive, custom)
- launchd template for scheduled daily sync (renderable via sed)
- ssr.conf.example with whitelisted KEY=VALUE config loader
- macos-defaults.sh extracted from inline block, overridable
- install.sh bootstrap symlinks CLI into ~/.local/bin
- README with usage, config table, migration map, security notes
- Original scripts archived under legacy/ for reference

Fixes vs originals: set -euo pipefail, quoted vars, find -print0,
spctl --global-disable (was --master-disable), MACOS=".macos" bug,
zero-width char before ln, Apple Silicon brew shellenv, config injection
hardening.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-11 15:05:17 +02:00
commit 539a8fc28f
23 changed files with 1171 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
# macos-defaults.sh — opinionated macOS preferences applied during restore.
# Override by setting SSR_MACOS_DEFAULTS in your config to your own script.
# Each block is independent; failures are logged but do not abort the script.
set -uo pipefail
run() {
if ! "$@"; then
printf '[macos-defaults] failed: %s\n' "$*" >&2
fi
}
# Dock: position + appearance
run defaults write com.apple.dock pinning -string middle
run defaults write com.apple.dock mouse-over-hilte-stack -bool true
# Dock: recent applications stack
run defaults write com.apple.dock persistent-others -array-add \
'{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }'
# Login window message (requires sudo; skipped without)
if sudo -n true 2>/dev/null; then
run sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "Welcome back..."
fi
# Time Machine on unsupported network volumes
run defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes -bool true
# Mail: prefer plain text
run defaults write com.apple.mail PreferPlainText -bool true
# Finder: show hidden files + path bar
run defaults write com.apple.finder AppleShowAllFiles -bool true
run defaults write com.apple.finder ShowPathbar -bool true
# Screenshots: save to ~/Pictures/Screenshots as PNG
mkdir -p "$HOME/Pictures/Screenshots"
run defaults write com.apple.screencapture location -string "$HOME/Pictures/Screenshots"
run defaults write com.apple.screencapture type -string png
# Reload affected services
killall Dock 2>/dev/null || true
killall Finder 2>/dev/null || true
killall SystemUIServer 2>/dev/null || true