#!/bin/sh

# chkconfig: 2345 88 06
# description: This script loads cpuid and msr kernel modules \
# required for TurionPowerControl. \
# TurionPowerControl is used to tweak AMD processors parameters \
# such as voltage, frequiency and so on.

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

RETVAL=0
SERVICENAME="TurionPowerControl"

# TODO:
#[ -f /usr/sbin/TurionPowerControl ] || exit 0
#
#prog="TurionPowerControl"
#
## Get config.
#if [ -f /etc/sysconfig/tpc ]; then
#        . /etc/sysconfig/tpc
#fi
#
#LOCKFILE=/var/lock/subsys/tpc

load_modules ()
{
    modprobe cpuid ||:
    modprobe msr ||:
}

# See how we were called.
case "$1" in
  condrestart)
  	;;
  start)
	echo -n "Enabling $SERVICENAME: "
	load_modules
	RETVAL=$?
	;;
  stop|condstop)
	echo -n "Disabling $SERVICENAME: "
	RETVAL=$?
	;;
  status)
	echo -n not implemented
	RETVAL=0
	;;
  restart)
  	"$0" stop; "$0" start
  	;;
  *)
	echo "Usage: $0 {start|stop|status|restart}"
	exit 1
esac

if [ $RETVAL -gt 0 ]; then
    echo_failure
else
    echo_success
fi
echo
exit $RETVAL
