fix: strip deprecated taps from Brewfile; restore Control Centre + menu bar

lib/brew.sh:
  Define _SSR_DEPRECATED_TAPS list (homebrew/core, /cask, /services,
  /test-bot, /bundle, /cask-fonts, /cask-drivers, /cask-versions).
  _ssr_brew_strip_deprecated_taps removes matching 'tap "…"' lines after
  dump so they never cause "Tapping X has failed!" errors on restore.

lib/macos-prefs.sh:
  Add com.apple.controlcenter, com.apple.systemuiserver and
  com.apple.notificationcenterui to SSR_MACOS_PREF_DOMAINS_DEFAULT so
  Control Centre module toggles, menu-bar extras order and Notification
  Centre widgets are included in the pref snapshot on every sync.
  Also add ControlCenter to the post-import service restart list.

lib/macos.sh:
  Add ControlCenter to ssr::macos::restart_ui so the menu bar and
  Control Centre panel pick up restored prefs immediately after mackup.
  Kill cfprefsd first in all restart sequences to flush the pref cache.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-12 09:55:29 +02:00
parent c330f96f9c
commit 87aaf25235
3 changed files with 44 additions and 6 deletions
+33
View File
@@ -47,6 +47,33 @@ ssr::brew::cleanup() {
brew cleanup --quiet || true
}
# Homebrew taps that have been deprecated and emptied upstream. Keeping them
# in the Brewfile causes "Tapping X has failed!" errors on every restore.
# brew bundle dump still emits them if they are locally present, so we strip
# them from the file after dumping.
_SSR_DEPRECATED_TAPS=(
homebrew/core
homebrew/cask
homebrew/services
homebrew/test-bot
homebrew/bundle
homebrew/cask-fonts
homebrew/cask-drivers
homebrew/cask-versions
)
_ssr_brew_strip_deprecated_taps() {
local file="$1"
local pattern
# Build an alternation pattern: homebrew/core|homebrew/cask|…
pattern="$(printf '%s|' "${_SSR_DEPRECATED_TAPS[@]}")"
pattern="${pattern%|}" # strip trailing |
local tmp; tmp="$(mktemp)"
# Match lines like: tap "homebrew/services"
grep -vE "^tap \"(${pattern})\"" "$file" > "$tmp" || true
mv -f "$tmp" "$file"
}
# Dumps Brewfile to the cloud backup dir with a timestamped rotation copy.
ssr::brew::dump() {
local backup_dir="$1" brewfile="$1/Brewfile"
@@ -59,6 +86,12 @@ ssr::brew::dump() {
cd "$backup_dir"
brew bundle dump --describe --quiet --force --file=Brewfile
)
# Remove deprecated taps that would fail on restore.
local removed
removed="$(grep -cE "^tap \"($(printf '%s|' "${_SSR_DEPRECATED_TAPS[@]}" | sed 's/|$//'))\"" \
"$brewfile" 2>/dev/null || echo 0)"
_ssr_brew_strip_deprecated_taps "$brewfile"
[[ "$removed" -gt 0 ]] && ssr::log "Stripped $removed deprecated tap(s) from Brewfile."
ssr::ok "Brewfile written ($(wc -l < "$brewfile" | tr -d ' ') lines)"
}