fix: replace removed brctl download with open -g; add -f to mackup restore
brctl download was removed in macOS Sonoma — the remaining subcommands are diagnose/log/dump/status/accounts/quota/monitor. Replace the dead call with a find loop that uses 'open -g <real-path>' to request per-file iCloud download from the daemon, followed by a 1-second settle pause and the existing .icloud stub deletion. Also add -f to mackup restore for consistency with the backup call. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+17
-8
@@ -44,13 +44,21 @@ ssr::mackup::_materialize_icloud() {
|
|||||||
*Mobile\ Documents*) ;; # only worth doing for iCloud
|
*Mobile\ Documents*) ;; # only worth doing for iCloud
|
||||||
*) return 0 ;;
|
*) return 0 ;;
|
||||||
esac
|
esac
|
||||||
# `brctl download` is the documented way to request file materialization.
|
# `brctl download` was removed in macOS Sonoma (remaining brctl subcommands:
|
||||||
# Available on macOS 10.12+; silently skip if missing on older systems.
|
# diagnose/log/dump/status/accounts/quota/monitor). The current way to
|
||||||
if command -v brctl >/dev/null 2>&1; then
|
# trigger per-file iCloud download from the CLI is `open -g <real-path>`,
|
||||||
brctl download "$mackup_root" >/dev/null 2>&1 || true
|
# which asks the iCloud daemon to fetch the file in the background.
|
||||||
fi
|
find "$mackup_root" -name '*.icloud' -type f 2>/dev/null | while IFS= read -r stub; do
|
||||||
# Belt-and-braces: prune any stub files that survived the download
|
local dir base real
|
||||||
# request (sometimes left over from interrupted prior runs).
|
dir="$(dirname "$stub")"
|
||||||
|
base="$(basename "$stub")"
|
||||||
|
real="${base#.}" # strip leading dot
|
||||||
|
real="${real%.icloud}" # strip .icloud suffix
|
||||||
|
open -g "$dir/$real" 2>/dev/null || true
|
||||||
|
done
|
||||||
|
# Brief pause so the iCloud daemon can start fetching before mackup reads.
|
||||||
|
sleep 1
|
||||||
|
# Belt-and-braces: prune any stubs that couldn't be resolved.
|
||||||
find "$mackup_root" -name '*.icloud' -type f -delete 2>/dev/null || true
|
find "$mackup_root" -name '*.icloud' -type f -delete 2>/dev/null || true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,5 +101,6 @@ ssr::mackup::backup() {
|
|||||||
|
|
||||||
ssr::mackup::restore() {
|
ssr::mackup::restore() {
|
||||||
ssr::log "mackup restore"
|
ssr::log "mackup restore"
|
||||||
mackup restore
|
# -f: answer "yes" to all prompts (consistent with backup behaviour).
|
||||||
|
mackup -f restore
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user