#!/bin/bash
HERE="$(cd "$(dirname "$(readlink -f "$0")")" && pwd -P)"
export APPDIR="$HERE"
source "$HERE/apprun-hooks/linuxdeploy-plugin-gtk.sh"
# linuxdeploy patches the bundled gtk/webkit libs' compiled-in /usr prefix
# to the relative "././" — those paths (webkit helper spawns, locale)
# resolve against the CWD, so the app must run with CWD = <pkg>/usr.
cd "$HERE/usr" || exit 1
[ -e /etc/fonts/fonts.conf ] || export FONTCONFIG_FILE="$HERE/usr/share/funx-fontconfig/fonts.conf"
exec "$HERE/usr/bin/fun-log-introspector" \
    --library-path "$HERE/usr/lib:$HERE/usr/lib/aarch64-linux-gnu" \
    --preload "$HERE/usr/lib/libfunx-gbm-compat.so" \
    --argv0 "$HERE/usr/bin/fun-log-introspector" \
    "$HERE/usr/bin/fun-log-introspector.bin" "$@"
