#!/usr/bin/env bash
set -euo pipefail
td_root="${PRODU2_TD_ROOT:-/data/anlogic/TD_Release_2026.1_SP2_NL}"
td_runtime="${PRODU2_TD_RUNTIME_LIB:-/data/prod2u/td-runtime/lib}"
td_runtime_root="${PRODU2_TD_RUNTIME_ROOT:-/data/prod2u/td-runtime/root}"
export LD_LIBRARY_PATH="${td_root}/lib:${td_root}/lib/Qt/lib:${td_runtime}:${td_runtime_root}/usr/lib/x86_64-linux-gnu:${td_runtime_root}/lib/x86_64-linux-gnu"
export QT_PLUGIN_PATH="${td_root}/lib/Qt/plugins"
export QT_QPA_PLATFORM=offscreen
# The vendor td.sh overwrites LD_LIBRARY_PATH and drops the persistent
# libusb runtime above. Execute the same vendor binary directly so the
# subprocess-scoped dependency set remains intact.
exec "${td_root}/bin/td" "$@"
