#!/bin/bash # Launch script for CoolReader 3 (cr3) - native Qt5 GUI application. set -e INSTALL_PREFIX="/workspace/install" EXE="${INSTALL_PREFIX}/bin/cr3" # Runtime library path (system Qt5 + all deps are system libs; include install lib just in case). export LD_LIBRARY_PATH="${INSTALL_PREFIX}/lib:${LD_LIBRARY_PATH}" # Qt plugin path (system Qt5 plugins). Detect via qmake if available, else common locations. if command -v qmake >/dev/null 2>&1; then QT_PLUGINS_DIR="$(qmake -query QT_INSTALL_PLUGINS 2>/dev/null || true)" fi for d in "${QT_PLUGINS_DIR}" /usr/lib/x86_64-linux-gnu/qt5/plugins /usr/lib/qt5/plugins; do if [ -n "$d" ] && [ -d "$d" ]; then export QT_PLUGIN_PATH="${d}${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}" fi done # Display (managed by the pipeline - use as-is). export DISPLAY="${DISPLAY:-:0}" # This is a native Qt/ATK app: expose the AT-SPI tree via the standard bridge. # Do NOT wrap in a private dbus-run-session; join the existing shared session bus. export NO_AT_BRIDGE=0 # Ensure a writable, unique HOME-style config dir so config writes never fail # (the app stores settings under $HOME/.cr3). Fall back to a temp dir if HOME # is unset or unwritable. if [ -z "$HOME" ] || [ ! -w "$HOME" ]; then export HOME="$(mktemp -d)" fi exec "$EXE" "$@"