#!/bin/sh
# Start/stop/restart the hal daemon:

hal_start()
{
  if [ -x /usr/sbin/hald ]; then
	if [ `/sbin/kernelversion` == "2.6" ]; then
	    echo "Starting HAL daemon:  /usr/sbin/hald"
	    /usr/sbin/hald --daemon=yes --retain-privileges
	else
	    echo "Kernel 2.6 is required for HAL features."
	fi
  fi
}

hal_stop()
{
  killall hald
}

hal_restart()
{
  hal_stop
  sleep 1
  hal_start
}

case "$1" in
'start')
  hal_start
  ;;
'stop')
  hal_stop
  ;;
'restart')
  hal_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac
