#!/bin/sh

###############################################################################
#
# Startup script for the lm_sensor device driver.
#
# chkconfig: 123 2 79
#
# description: This driver provides access to the i2c hardware.
#
# Copyright (c) Intel Corporation 2000
#
###############################################################################

. /etc/rc.d/init.d/functions

# See how we were called.
case "$1" in
  start)
	echo -n "Starting lm_sensor drivers: "
	if command /sbin/insmod i2c-piix4 ; then
	    if command /sbin/insmod sensors ; then 
	       if command /sbin/insmod adm9240 ; then
		  echo_success
	       else
		  /sbin/rmmod sensors
		  /sbin/rmmod i2c-piix4
		  echo_failure
	       fi
	    else
	       /sbin/rmmod i2c-piix4
	       echo_failure
	    fi
	else
	    echo_failure
	fi
	echo 
	;;
  stop)
	echo -n "Stopping lm_sensor drivers: "
	/sbin/rmmod adm9240
	/sbin/rmmod sensors
	/sbin/rmmod i2c-piix4
	echo_success
	echo
	;;
  *)
	echo "Usage: $0 {start|stop}"
	exit 1
esac

exit 0
