#!/bin/sh
# 
# hulda	Kernel UEvents to D-Bus system daemon proxy etc.
#
# Copyright (C) 2004-2007 Nokia Corporation. All rights reserved.
#
# 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

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/hulda
NAME=hulda
DESC="hulda"
USER=root
DTOOL=/usr/sbin/dsmetool
PARAMS=''

test -x $DAEMON || exit 0

source /etc/osso-af-init/af-defines.sh

case "$1" in
  start)
	echo -n "Starting $DESC: "

	if [ -x $DTOOL ]; then
        	$DTOOL -U $USER -n -1 -t $DAEMON
	else
		start-stop-daemon -b --start --quiet --user $USER \
			--exec $DAEMON -- $PARAMS
	fi
	echo "$NAME."
	;;
  stop)
	echo -n "Stopping $DESC: "

	if [ -x $DTOOL ]; then
		$DTOOL -k $DAEMON
	else
		start-stop-daemon --stop --quiet --oknodo --user $USER \
			--exec $DAEMON -- $PARAMS
	fi

	echo "$NAME."
	;;
  reload|restart|force-reload)
	#
	#	If the "reload" option is implemented, move the "force-reload"
	#	option to the "reload" entry above. If not, "force-reload" is
	#	just the same as "restart".
	#
	"$0" stop
        sleep 1
	"$0" start
	;;
  *)
	N=/etc/init.d/$NAME
	# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0
