#!/bin/bash
#
# This script is invoked by pmud to configure the system for a
# given power level. The desired level is indicated by the first
# argument and can take the following values:
#
# minimum = minimum power
# medium  = medium power 
# maximum = full power  
# sleep   = prepare for sleep
# wakeup  = system woke up after a sleep
# warning = low battery condition detected, issue a warning to users
#
# the second argument gives the current power source, and can take the
# following values:
#
# ac
# battery
#

PATH=/bin:/sbin:/usr/bin:/usr/sbin
cd `dirname $0`

case "$1" in
  warning)
    wall "Low battery - system will go down now!"
    ;;
  minimum)
    run-parts --arg="powersave" --arg="$2" active
    ;;
  medium)
    run-parts --arg="custom" --arg="$2" active
    ;;
  maximum)
    run-parts --arg="performance" --arg="$2" active
    ;;
  sleep|wakeup)
    run-parts --arg="$1" --arg="$2" active
    ;;
esac

exit 0
