#! /bin/sh
#
# pmud	       Power Manager daemon for Apple powerbooks
#
# chkconfig: 2345 40 60
# description: pmud is a daemon which periodically polls the PMU \
#              (power manager) and performs functions such as enabling \
#              or disabling devices appropriately when the power source \
#              changes.
# processname: pmud
# config: /etc/powerlevels
# pidfile: /var/run/pmud.pid

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

# Source power daemon options
[ -f /etc/sysconfig/power ] && . /etc/sysconfig/power

# See how we were called.
case "$1" in
  start)
        if grep -i "PowerBook" /proc/cpuinfo >/dev/null; then
	   echo -n "Starting pmud daemon: "
           /usr/bin/trackpad notap &> /dev/null
	   daemon pmud $PMUD_FLAGS
	   echo
	   touch /var/lock/subsys/pmud
	fi
	;;
  stop)
        if grep -i "PowerBook" /proc/cpuinfo >/dev/null; then
	   echo -n "Stopping pmud daemon: "
	   killproc pmud
	   echo
	   rm -f /var/lock/subsys/pmud
	fi
	;;
  status)
	status pmud
	;;
  *)
	echo "Usage: pmud {start|stop|status}"
	exit 1
esac

exit 0
