From 52d01a7277ee23e210b725a77ec0a4920a64e1cb Mon Sep 17 00:00:00 2001 From: Mayank Kumar Date: Tue, 10 Apr 2018 22:19:57 -0400 Subject: [PATCH] Fix backup update overwrite on already-patched system (edge case) --- purge-wrangler.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/purge-wrangler.sh b/purge-wrangler.sh index bc9351a..070c605 100755 --- a/purge-wrangler.sh +++ b/purge-wrangler.sh @@ -255,6 +255,18 @@ backup_system() else echo "Different build/version of macOS detected. Updating backup...\n" rm -r "$backup_agc" + if [[ "$patch_status" == 1 ]] + then + echo "Uninstalling patch before backup update...\n" + echo "Re-running script...\n" + sleep 3 + "$0" "uninstall" "-f" + echo "System re-patched.\n" + echo "Re-running script...\n" + sleep 3 + "$0" "$operation" "$advanced_operation" + exit + fi execute_backup echo "Update complete.\n" fi