#!/bin/sh

prefix=/usr
PKGLIBEXECDIR=/usr/libexec/aarch64-linux-gnu/4ti2

# We locate where this script is so we can call the executable zsolve which
# should be in the same directory as this script.
SCRIPT=${0}
SCRIPTDIR=${SCRIPT%/*}
EXECUTABLE=4ti2-zsolve

for DIR in "$SCRIPTDIR" "$PKGLIBEXECDIR/bin"; do
	if [ -x "$DIR/$EXECUTABLE" ]; then break; fi
done

# Check if zsolve executable exists.
if [ ! -f "$DIR/$EXECUTABLE" ]
then
    echo "Error: Unable to find the executable \`$EXECUTABLE'."
    echo "Error: It should have been in the directory \`$DIR'."
    exit 1
fi

exec $DIR/$EXECUTABLE -H $@
