#!/bin/bash

# PowerManagement Control Script
# This script will be called on certain events from a
# powermanagement daemon with two arguments. The first
# argument contains the command and the second the
# currently active power source.
#
# arg $1: powersave     minimum power consumption
#         performance   maximum performance
#         sleep         prepare for sleep
#         wakeup        recovering from sleep
#
# arg $2: ac            running on ac power
#         battery       running on battery
#
# Options for this scripts will be kept in the central
# configuration file ../config. Variables for each script
# will be introduced by a special unique prefix.

# name        : pmac_3400
# prefix      : PMAC3400_
# author      : 
# description : hardware related stuff for PowerBook 3400
# requirements: 
# limitations :
#
# --- end of public part -- don't change below this line ---

PATH=/bin:/sbin:/usr/bin:/usr/sbin

# source configuration
. config

case "$1" in
  powersave)
    echo 1 >/proc/sys/kernel/powersave-nap
    ;;
  performance)
    echo 0 >/proc/sys/kernel/powersave-nap
    ;;
  sleep)
    ifconfig eth0 down
    ;;
  wakeup)
    ifconfig eth0 up
    ;;
esac

exit 0
