diff options
| author | Danilo M. <danix@danix.xyz> | 2026-07-11 11:02:22 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-07-11 11:02:22 +0200 |
| commit | a7c03410075c375dd765381c56a7a783abe3c43b (patch) | |
| tree | d37734585b4dfb80995dce6149faaa04f1684f80 /sbo-batch-test | |
| parent | 3acd48aad8be07754581650ee6400de88073290c (diff) | |
| download | sbo-batch-tester-a7c03410075c375dd765381c56a7a783abe3c43b.tar.gz sbo-batch-tester-a7c03410075c375dd765381c56a7a783abe3c43b.zip | |
Add shadow_scan (confirm + rm -r upstream dups)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'sbo-batch-test')
| -rwxr-xr-x | sbo-batch-test | 29 |
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: |
