#! /bin/sh
#
# Startup script for the crash-reporter.
#
#
# Copyright (C) 2006-2008 Nokia Corporation.
#
# Contact: Eero Tamminen <eero.tamminen@nokia.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA

### BEGIN INIT INFO
# Provides: 		Crash-Reporter
# Required-Start:	ke-recv
# Required-Stop:	ke-recv
# Default-Start: 	2 3 4
# Default-Stop:		0 1 5 6
# Short-Description:	Start Crash-Reporter daemon	
### END INIT INFO


PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/crash_reporter_daemon
NAME=crash-reporter
DESC="crash-reporter daemon"
INITFILE=/etc/init.d/$NAME

# abort if no executable exists
test -x $DAEMON || exit 0

if [ -e /etc/osso-af-init/af-defines.sh ]
then
  source /etc/osso-af-init/af-defines.sh
else
  echo "/etc/osso-af-init/af-defines.sh not found!"
  exit 0
fi                                                               
                                                                 
for i in /etc/osso-af-init/*.defs                  
do                                                 
  source $i                                        
done

case "$1" in
  start)
        echo "Starting Crash Reporter DAEMON"
        dsmetool -U user -f $DAEMON -c 10
	;;
  stop)
  	echo -n "Stopping $DESC "
	dsmetool -k "$DAEMON"
	;;
  restart|force-reload)
  	$0 stop
	$0 start
	;;
  *)
      	;;
esac

exit 0
