From b4ac5a4de0faebe99fb172042852b356c5535281 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 2 Sep 2026 19:28:28 +0000 Subject: [PATCH] wolf: fix TI-99/4A ES-DE command line never actually updating on re-run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Confirmed live: the command-line fix from an earlier commit (cd into emulators/ before launching ti99sim-sdl) never reached the user's actual es_systems.xml, because the write step's guard was "skip entirely if a ti994a entry already exists" — which it did, with the old pre-fix command line still in it. The check only asked whether an entry existed, never whether its content matched the current template. Now always strips any existing ti994a block and re-adds the current one fresh on every run, via a small python3 rewrite (regex block removal + re-append) instead of a blind append-once guard. Tested against a stand-in file matching the real stale content, and for idempotency (second run doesn't duplicate the block), before pushing. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01VLX1yYKJExGSXmgUhxKQG6 --- services/wolf.sh | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/services/wolf.sh b/services/wolf.sh index 32ede95..3bda79f 100644 --- a/services/wolf.sh +++ b/services/wolf.sh @@ -966,12 +966,22 @@ UDEV if [[ "$_GET_TI99" =~ ^[Yy]$ ]]; then mkdir -p "$GAME_STORAGE_DIR/esde-custom-systems" "$GAME_STORAGE_DIR/roms/ti994a" local _TI99_XML="$GAME_STORAGE_DIR/esde-custom-systems/es_systems.xml" - if [ ! -f "$_TI99_XML" ] || ! grep -q 'ti994a' "$_TI99_XML" 2>/dev/null; then - backup_if_exists "$_TI99_XML" - [ -f "$_TI99_XML" ] || echo '' > "$_TI99_XML" - sed -i 's###' "$_TI99_XML" 2>/dev/null - cat >> "$_TI99_XML" << 'XMLEOF' - + backup_if_exists "$_TI99_XML" + # Always strip and re-add the ti994a block rather than "skip if + # already present" — confirmed live: that check left a stale + # line in place across a real fix to it, since existing + # was already "present" and the check never looked at whether its + # content matched the current template. + python3 - "$_TI99_XML" << 'TI99XMLPY' +import re, sys +path = sys.argv[1] +try: + with open(path) as f: + content = f.read() +except FileNotFoundError: + content = '\n\n' +content = re.sub(r'[ \t]*\s*ti994a.*?\s*\n?', '', content, flags=re.DOTALL) +block = ''' ti994a Texas Instruments TI-99/4A %ROMPATH%/ti994a @@ -980,13 +990,13 @@ UDEV ti99 ti99 - -XMLEOF - chown "$ACTUAL_USER:$ACTUAL_USER" "$_TI99_XML" - log_success "TI-99/4A added as an ES-DE system (roms/ti994a/, custom_systems/es_systems.xml)" - else - log_info "TI-99/4A system definition already present — left as-is." - fi +''' +content = content.replace('', block + '') +with open(path, 'w') as f: + f.write(content) +TI99XMLPY + chown "$ACTUAL_USER:$ACTUAL_USER" "$_TI99_XML" + log_success "TI-99/4A ES-DE system definition written/refreshed (roms/ti994a/, custom_systems/es_systems.xml)" echo "" if [ ! -x "$GAME_STORAGE_DIR/emulators/ti99sim-sdl" ]; then # Build inside a container running the EXACT SAME image ES-DE