#!/usr/bin/env bash # Re-export TaxiNodes / TaxiPath / TaxiPathNode DBCs from custom_taxi_* # tables, copy them into the worldserver's bind-mounted data directory, # and restart the worldserver. Idempotent. # # Vanilla baseline lives in var/client-data-vanilla/ and is treated as # read-only: the export tool reads from there but writes to # build/taxi/export/. Never point --vanilla-dir at the live tree, or # subsequent exports will compound their own custom rows. set -euo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" VANILLA_DIR="${VANILLA_DIR:-$ROOT_DIR/var/client-data-vanilla}" LIVE_DIR="${LIVE_DIR:-$ROOT_DIR/var/client-data-live/dbc}" EXPORT_DIR="${EXPORT_DIR:-$ROOT_DIR/build/taxi/export}" SERVER_OUT="$EXPORT_DIR/server/dbc" log() { printf '[redeploy] %s\n' "$*"; } if [[ ! -d "$VANILLA_DIR" ]]; then printf 'vanilla snapshot not found: %s\n' "$VANILLA_DIR" >&2 printf 'Create it once from a clean live tree:\n' >&2 printf ' mkdir -p %s && cp %s/Taxi*.dbc %s/\n' \ "$VANILLA_DIR" "$LIVE_DIR" "$VANILLA_DIR" >&2 exit 1 fi if [[ ! -d "$LIVE_DIR" ]]; then printf 'live dbc dir not found: %s\n' "$LIVE_DIR" >&2 exit 1 fi cd "$ROOT_DIR" log "exporting DBCs from $VANILLA_DIR" python3 "$ROOT_DIR/tools/moonwell-taxi/moonwell_taxi.py" export-dbc \ --vanilla-dir "$VANILLA_DIR" \ --output-dir "$EXPORT_DIR" log "copying server DBCs into $LIVE_DIR" cp "$SERVER_OUT/TaxiNodes.dbc" "$LIVE_DIR/" cp "$SERVER_OUT/TaxiPath.dbc" "$LIVE_DIR/" cp "$SERVER_OUT/TaxiPathNode.dbc" "$LIVE_DIR/" if docker compose ps --status running --services 2>/dev/null | grep -qx 'ac-worldserver'; then log "restarting ac-worldserver" docker compose restart ac-worldserver else log "ac-worldserver is not running; new DBCs will be picked up on next start" fi log "done"