#!/bin/sh
#
# haldaemon:	HAL daemon
#
# chkconfig:	345 11 91
#
# description:	This is a daemon for collecting and maintaing information
#               about hardware from several sources.
#               See http://www.freedesktop.org/software/hal
#

### BEGIN INIT INFO
# Provides:          hald
# Required-Start:    $local_fs
# Required-Stop:
# Default-Start:     3 4 5
# Default-Stop:      0 1 2 6
# Short-Description: Start hald at boot time
# Description:       Collecting and maintaing information about hardware
### END INIT INFO

# Do not load RH compatibility interface.
WITHOUT_RC_COMPAT=1

# Source function library
. /etc/rc.d/init.d/functions

DAEMON=/usr/sbin/hald
LOCKFILE=/var/lock/subsys/hal
PIDFILE=/var/run/hal.pid
RETVAL=0

start()
{
	msg_starting $"HAL"
	start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --no-announce -- $DAEMON
	RETVAL=$?
	return $RETVAL
}

stop()
{
	msg_stopping $"HAL"
	stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --no-announce -- $DAEMON
	RETVAL=$?
	return $RETVAL
}

restart()
{
	stop
	start
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart)
	restart
	;;
  reload)
	;;
  condrestart)
	if [ -e "$LOCKFILE" ]; then
	    restart
	fi
	;;
  condreload)
	;;
  condstop)
  	if [ -e "$LOCKFILE" ]; then
  	    stop
	fi
	;;
  status)
	status --pidfile "$PIDFILE" -- $DAEMON
	RETVAL=$?
	;;
  *)
	msg_usage "${0##*/} {start|stop|restart|reload|condrestart|condreload|condstop|status}"
	RETVAL=1
esac

exit $RETVAL
