#!/bin/sh

# AbiWord wrapper script for Debian GNU/Linux.  This script should be
# called "AbiWord" and should reside in /usr/bin.

# debian developer note: staticly linked binaries are heavily discouraged.
# If it were up to me, I'd not even include the lines relating to them.

# Change this if you move the AbiSuite tree.
ABISUITE_HOME=/usr/share/abisuite
export ABISUITE_HOME

# Change this if you move your fonts
ABISUITE_FONT_HOME=$ABISUITE_HOME/fonts

# Hard coded for a Debian system
DYNAMIC_BIN=/usr/bin/AbiWord_d
STATIC_BIN=/usr/bin/AbiWord_s

# Set run-time font path
if [ -d $ABISUITE_FONT_HOME ]
then
    xset fp+ $ABISUITE_FONT_HOME 1>/dev/null 2>/dev/null
fi

# Figure out which binary to run
if [ -f $DYNAMIC_BIN ]
then
    $DYNAMIC_BIN "$@"
elif [ -f $STATIC_BIN ]
then
    $STATIC_BIN "$@"
else
    echo "Error: can't find AbiWord executables:"
    echo "    $DYNAMIC_BIN"
    echo "    -or-"
    echo "    $STATIC_BIN"
    echo ""
    exit
fi

# Set post run-time font path
if [ -d $ABISUITE_FONT_HOME ]
then
    xset fp- $ABISUITE_FONT_HOME 1>/dev/null 2>/dev/null
fi
