aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsbo-batch-test29
1 files changed, 29 insertions, 0 deletions
diff --git a/sbo-batch-test b/sbo-batch-test
index c028df1..9a4b2a9 100755
--- a/sbo-batch-test
+++ b/sbo-batch-test
@@ -369,6 +369,35 @@ collect_shadows() {
done < <(find "${personal_dirs[@]}" -mindepth 1 -maxdepth 1 -type d)
}
+# Show the upstream dups of personal packages, confirm, and rm -r them. Reads
+# the set from collect_shadows. Interactive by design (the user wants to see
+# removals before they happen). No git (the 15.0 tree is rsync'd, not git).
+shadow_scan() {
+ local root="$1"
+ local -a to_shadow=()
+ mapfile -t to_shadow < <(collect_shadows "$root")
+ if [[ ${#to_shadow[@]} -eq 0 ]]; then
+ echo "No upstream packages match your personal subtrees. Nothing to shadow."
+ return
+ fi
+ echo
+ echo "The following upstream packages will be shadowed (rm -r):"
+ local item
+ for item in "${to_shadow[@]}"; do
+ echo " - $item"
+ done
+ echo
+ read -rp "Proceed? [y/N] " confirm
+ if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
+ echo "Aborted shadowing; no packages were removed."
+ return
+ fi
+ for item in "${to_shadow[@]}"; do
+ echo "Shadowing: $item"
+ rm -r "${root:?}/$item"
+ done
+}
+
# =============================================================================
# Package cache. Persistent, on-disk store of built packages so unchanged deps
# are installed from cache instead of rebuilt. Layout mirrors the SBo tree: