#! /bin/sh
#
# installer       Bring up/down installer
#
# description: Activates/Deactivates installer to \
#              start at boot time.
#
### BEGIN INIT INFO
# Provides: $installer
# Should-Start: installer
# Short-Description: Bring up/down installer
# Description: Bring up/down installer
### END INIT INFO

RETVAL=0

# See how we were called.
case "$1" in
  start)        
        start-stop-daemon -S -x /usr/bin/installer
        RETVAL=$?
        ;;
  stop)
        start-stop-daemon -K -x /usr/bin/installer
        RETVAL=$?
        ;;
  status)
        local status=`pgrep installer`
        pgrep installer &> /dev/null
        rc=$?       
        if [ "$rc" -gt 0 ]; then
            echo $"$1 not running"
        else
            echo $"$1 running pid: $status"
        fi
        RETVAL=$rc
        ;;
  restart|reload|force-reload)
        cd "$CWD"
        $0 stop
        $0 start
        RETVAL=$?
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}"
        exit 2
esac
exit $RETVAL


