PortableLinuxGames/data/AppRun_linker

47 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Author : Ismael Barros² <ismael@barros2.org>
# License : BSD http://en.wikipedia.org/wiki/BSD_license
export APPDIR="$(dirname "$(readlink -f "$0")")"
export APPPKG="$(basename "$APPIMAGE")"
LOGFILE=$(mktemp "/tmp/AppRun-log-${APPPKG}.XXXXXXXXXX")
BINARY="./_BINARY_"
BINARY_ARGS=
. "$APPDIR/util.sh"
# Uncomment this if the app needs relative paths specified on the command line
#eval arguments="$(patch_relative_paths "$@")"
#set -- "${arguments[@]}"
export PATH="$APPDIR/usr/bin/:$PATH"
[ -z "$*" ] && show_usage "$APPDIR/usage.txt"
setup_keepResolution
ret=0
cd "$APPDIR/usr/"
{
if [[ "$(file "$BINARY")" =~ ELF.*\ interpreter\ ([^,]+) ]]; then
linker="$APPDIR/usr/lib/$(basename "${BASH_REMATCH[1]}")"
if [ -f "$linker" ]; then
export RUNELF_HELPERS="$linker"
else
echo "!! Linker not found in $linker" >&2
fi
else
linker=""
echo "!! Could not find architecture: $(file "$BINARY")" >&2
fi
run_withLocalLibs $APPRUN_HELPERS $RUNELF_HELPERS "$BINARY" $BINARY_ARGS "$@"
ret=$?
} 2>&1 | tee "$LOGFILE"
[ $ret != 0 -a $ret != -1 ] && {
build_report "$LOGFILE" "$BINARY" > "${LOGFILE}.html"
xdg-open "${LOGFILE}.html" &
}