#! /bin/sh
# /etc/init.d/xfs: start or stop the font server.

test -x /usr/bin/X11/xfs || exit 0

test -f /etc/X11/config || exit 0

if grep -q ^xbase-not-configured /etc/X11/config
then
  exit 0
fi

run_xfs=0
if grep -q ^start-xfs /etc/X11/config
then
  run_xfs=1
fi

# The TCP port number on which the font server will
# listen for connections.
port=7100

case "$1" in
  start)
    if [ $run_xfs = 1 ]
    then
      echo Starting xfs
      /usr/bin/X11/xfs -port $port &
    fi
    ;;
  stop)
      start-stop-daemon --stop --verbose --exec /usr/bin/X11/xfs
    ;;
  *)
    echo "Usage: /etc/init.d/xfs {start|stop}"
    exit 1
esac

exit 0
