#!/usr/bin/env bash # Resolve the side-by-side version-conflict decisions (pairs 1-4,6-8; 5 & 9 were # swapped live via fresh patches). Guarded: del only if present, mv only if dst free. # DRY_RUN=1 bash resolve-version-conflicts.sh (default) # DRY_RUN=0 bash resolve-version-conflicts.sh set -u G=/storage1/Emulation/roms/gba DRY_RUN=${DRY_RUN:-1} del(){ local f="$1/$2"; if [ ! -f "$f" ]; then echo "SKIP del (missing): $2"; return; fi if [ "$DRY_RUN" = 1 ]; then echo "DEL $2"; else rm -- "$f" && echo "DEL $2"; fi; } mv1(){ local s="$1/$2" d="$1/$3"; if [ ! -f "$s" ]; then echo "SKIP mv (missing src): $2"; return; fi if [ -e "$d" ]; then echo "SKIP mv (dst exists): $3"; return; fi if [ "$DRY_RUN" = 1 ]; then echo "MV $2 -> $3"; else mv -n -- "$s" "$d" && echo "MV $2 -> $3"; fi; } echo "=== deletes (older/superseded loose copies) ===" del "$G" "Pokemon - Unbound [Hack].gba" # pair2: older 2.1.1, replaced by loose 2.1.1.1 del "$G" "supermariomon v1.3.gba" # pair6: older than catalog 1.5 del "$G" "HnS_v1.0.gba" # pair7: older than catalog 1.2.1 del "$G" "advanceredux 31-3-25 (2).gba" # pair8: 2020 build, catalog is 2026 echo echo "=== pair3 Dark Rising: fix the mislabeled Digimon file, then promote the real DR1 ===" mv1 "$G" "Pokemon - Dark Rising [Hack].gba" "Pokemon vs Digimon - Worlds Collide [Hack].gba" mv1 "$G" "PokemonDarkRising1Complete.GBA" "Pokemon - Dark Rising [Hack].gba" echo echo "=== pair2 Unbound: promote the newer loose 2.1.1.1 ===" mv1 "$G" "Pokemon Unbound.gba" "Pokemon - Unbound [Hack].gba" echo echo "=== pair1 GS Chronicles: keep both, disambiguate the Gold inc build ===" mv1 "$G" "Pokemon GS Chronicles (Beta 2.7.1).gba" "Pokemon - GS Chronicles (Gold inc) [Hack].gba" echo echo "=== pair4 Dark Worship: keep both, conform the Super Dark Worship name ===" mv1 "$G" "Super Dark Worship Oficial.gba" "Pokemon - Super Dark Worship [Hack].gba" echo echo "Done (DRY_RUN=$DRY_RUN)."