fix(mackup): update backup path and enhance configuration handling
- Corrected the backup path in the `_in_backup` function to reflect the new structure under `mackup/`. - Improved error handling in `ssr::mackup::configure` to skip restore if the configuration file is not updated, providing user feedback. - Updated `ssr::sync` to conditionally execute backup based on configuration validity, enhancing robustness. - Revised documentation in configuration examples to clarify the new Mackup directory structure and its implications for users.
This commit is contained in:
+1
-1
@@ -71,7 +71,7 @@ cmd_scan() {
|
||||
done <<< "$declared"
|
||||
return 1
|
||||
}
|
||||
_in_backup() { [[ -n "$mackup_dir" && -e "$mackup_dir/$1" ]]; }
|
||||
_in_backup() { [[ -n "$mackup_dir" && -e "$mackup_dir/mackup/$1" ]]; }
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# Collect candidate items — same logic as generate_custom_cfg.
|
||||
|
||||
+4
-1
@@ -90,7 +90,10 @@ ssr::icloud::prefetch "$mackup_dir"
|
||||
# ssr::mackup::restore already calls ssr::icloud::wait internally.
|
||||
_ssr_mackup_restore_step() {
|
||||
ssr::mackup::ensure_installed
|
||||
ssr::mackup::configure "$mackup_dir"
|
||||
ssr::mackup::configure "$mackup_dir" || {
|
||||
ssr::warn "Skipping mackup restore — ~/.mackup.cfg was not updated (see messages above)."
|
||||
return 1
|
||||
}
|
||||
ssr::mackup::restore
|
||||
}
|
||||
|
||||
|
||||
+7
-2
@@ -39,7 +39,8 @@ ssr::icloud::prefetch "$mackup_dir"
|
||||
|
||||
ssr::brew::ensure_installed
|
||||
ssr::mackup::ensure_installed
|
||||
ssr::mackup::configure "$mackup_dir"
|
||||
_mackup_cfg_ok=true
|
||||
ssr::mackup::configure "$mackup_dir" || _mackup_cfg_ok=false
|
||||
|
||||
ssr::brew::update
|
||||
ssr::brew::upgrade
|
||||
@@ -48,7 +49,11 @@ ssr::brew::upgrade
|
||||
# Timeout (seconds) is configurable; default 180s.
|
||||
ssr::icloud::wait "$mackup_dir" "${SSR_ICLOUD_WAIT_TIMEOUT:-180}"
|
||||
|
||||
ssr::mackup::backup
|
||||
if [[ "$_mackup_cfg_ok" == true ]]; then
|
||||
ssr::mackup::backup
|
||||
else
|
||||
ssr::warn "Skipping mackup backup — ~/.mackup.cfg was not updated (see messages above)."
|
||||
fi
|
||||
ssr::brew::dump "$backup_dir"
|
||||
ssr::brew::cleanup
|
||||
|
||||
|
||||
Reference in New Issue
Block a user