#!/usr/bin/env sh
set -eu
self=$0
case "$self" in
  */*) ;;
  *) self=$(command -v -- "$self" 2>/dev/null || printf '%s' "$self") ;;
esac
case "$self" in
  /*) ;;
  *) self=$(pwd)/$self ;;
esac
bin_dir=${self%/*}
real="$bin_dir/launcher-core.bin"
PLATFORMLESS_BUNDLE_BIN_DIR="$bin_dir"
export PLATFORMLESS_BUNDLE_BIN_DIR
for lib_dir in "$bin_dir/lib" "$bin_dir/../lib" "$bin_dir/../../../lib"; do
  loader="$lib_dir/ld-linux-x86-64.so.2"
  if [ -x "$loader" ]; then
    exec "$loader" --library-path "$lib_dir" "$real" "$@"
  fi
done
echo "platformless bundled loader not found for $self" >&2
exit 127
