#!/usr/bin/env bash # scripts/igir-dorename.sh (runs ON valhalla) # # igir 'move' to canonical No-Intro/Redump names, in place, for one platform. # Records a before/after filename manifest under /storage1/igir/manifests for # reversibility. Unmatched files are left untouched; --dir-game-subdir never # keeps the folder flat (EmuDeck expects flat per-platform dirs). # # Only run on platforms that scored healthy in igir-dryrun.sh (>=~80% identified) # AND have no co-located saves keyed to ROM basenames (renaming would orphan # them) AND are NOT disc systems with .m3u multi-disc playlists (renaming the # images breaks the playlists). Carts are the safe case. # # ssh ginnoir@valhalla 'bash -s -- gb "no-intro/Nintendo - Game Boy.dat"' < scripts/igir-dorename.sh # # or, already deployed on the host: # ssh ginnoir@valhalla 'bash /storage1/igir/dorename.sh nes "no-intro/Nintendo - Nintendo Entertainment System.dat"' # # Undo: the before-manifest lists original names; igir is deterministic, so # re-running against the same DAT is idempotent. set -uo pipefail plat="$1"; shift dargs=(); for d in "$@"; do dargs+=(-d "/dats/$d"); done mkdir -p /storage1/igir/manifests before="/storage1/igir/manifests/${plat}-before.txt" after="/storage1/igir/manifests/${plat}-after.txt" ls -1 "/storage1/Emulation/roms/$plat" > "$before" docker run --rm \ -v /storage1/Emulation/roms:/input \ -v /storage1/igir/dats/libretro-database/metadat:/dats:ro \ -v /storage1/igir/reports:/output \ node:lts npx -y igir@latest move "${dargs[@]}" \ --dir-game-subdir never \ -i "/input/$plat" -o "/input/$plat" 2>&1 \ | grep -vE "npm notice|npm warn" || true ls -1 "/storage1/Emulation/roms/$plat" > "$after" echo "RENAME $plat: before_files=$(wc -l < "$before") after_files=$(wc -l < "$after")"