#! /bin/sh

PATH=/bin:/usr/bin:/sbin:/usr/sbin

GNUSTEP_SYSTEM_ROOT=/usr/lib/GNUstep
export GNUSTEP_SYSTEM_ROOT

DAEMON=$GNUSTEP_SYSTEM_ROOT/Tools/sparc/linux-gnu/gdomap
PIDFILE=/var/run/gdomap.pid

# The following value is extracted by debstd to figure out how to generate
# the postinst script. Edit the field to change the way the script is
# registered through update-rc.d (see the manpage for update-rc.d!)
FLAGS="defaults 50"

test -f $DAEMON || exit 0

case "$1" in
  start)
    echo -n "Starting GNUStep distributed object mapper: gdomap"
    start-stop-daemon --start --quiet --pid $PIDFILE --exec $DAEMON \
    	-- -p -I $PIDFILE
    #start-stop-daemon --start --quiet --pid $PIDFILE --exec $DAEMON \
    #	-- -c /etc/GNUstep/gdomap_probes -I $PIDFILE
    echo "."
    ;;
  stop)
    echo -n "Stopping GNUStep distributed object mapper: gdomap"
    start-stop-daemon --stop --quiet --pid $PIDFILE \
    	-- -p -I $PIDFILE
    rm -f $PIDFILE
    echo "."
    ;;
  restart)
    /etc/init.d/GNUstep stop
    /etc/init.d/GNUstep start
    ;;
  *)
    echo "Usage: /etc/init.d/`basename $0` {start|stop|restart}"
    exit 1
    ;;
esac

exit 0
