539a8fc28f
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>
37 lines
910 B
Bash
Executable File
37 lines
910 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# ssr-config — show or edit the active configuration file.
|
|
|
|
set -euo pipefail
|
|
SSR_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
# shellcheck source=../lib/common.sh
|
|
source "$SSR_ROOT/lib/common.sh"
|
|
|
|
cfg="${SSR_CONFIG:-$HOME/.config/ssr/ssr.conf}"
|
|
|
|
case "${1:-show}" in
|
|
show)
|
|
if [[ -f "$cfg" ]]; then
|
|
echo "# $cfg"
|
|
cat "$cfg"
|
|
else
|
|
ssr::warn "No config found at $cfg"
|
|
echo "Run: ssr install to seed one from the example."
|
|
exit 1
|
|
fi
|
|
;;
|
|
edit)
|
|
ssr::ensure_dir "$(dirname "$cfg")"
|
|
if [[ ! -f "$cfg" ]]; then
|
|
cp "$SSR_ROOT/config/ssr.conf.example" "$cfg"
|
|
chmod 600 "$cfg"
|
|
fi
|
|
"${EDITOR:-vi}" "$cfg"
|
|
;;
|
|
path)
|
|
echo "$cfg"
|
|
;;
|
|
*)
|
|
ssr::die "Usage: ssr config [show|edit|path]"
|
|
;;
|
|
esac
|