#!/bin/bash # ----------------------------------------------------------------------------- # $Id: pwrctl-local,v 1.1 2004/03/16 04:50:41 warpzero Exp $ # # This script is invoked by pwrctl to configure the system for a # given power level. The desired level is indicated by the first # argument, which can have 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 # # # This script can be invoked by pwrctl when it is named /etc/power/pwrctl-local # and is executable. Pwrctl is called by pmud on a power event. If this # script returns the value 1, then pwrctl will skip it's main body # # Example usage: use ifdown -a on sleep (and ifup -a on wakeup) to # automagically renew DHCP leases. Similar use of iwconfig down/up might be # required for Wavelan users with older versions of the kernel. # # ----------------------------------------------------------------------------- # $Log: pwrctl-local,v $ # Revision 1.1 2004/03/16 04:50:41 warpzero # app-laptop moves for ppc # # Revision 1.1 2002/04/27 10:34:28 pvdabeel # PPC sys-apps merge # # Revision 1.1 2002/04/14 03:41:31 kain # Initial import of PMUD for gentoo-ppc # # Revision 1.1.1.1 2001/12/07 11:31:48 sleemburg # Initial CVS import of the unreleased pmud-0.8 to apmud (new project name # because of a name clash at sourceforge.net). # # Revision 1.2 2000/03/25 21:26:37 stephan # pmud-0.5 changes # # Revision 1.1 2000/03/09 13:02:18 stephan # Initial revision # # ----------------------------------------------------------------------------- logger=/usr/bin/logger # ----------------------------------------------------------------------------- # main # ----------------------------------------------------------------------------- case "$1" in minimum) $logger -p daemon.info -t pwrctl-local "minimum power $2" ;; medium) $logger -p daemon.info -t pwrctl-local "medium power $2" ;; maximum) $logger -p daemon.info -t pwrctl-local "maximum power $2" $logger -p daemon.info -t pwrctl-local "skipping pwrctl-main" exit 1 ;; warning) /usr/bin/wall "Low battery, system going down any minute now" ;; lid-closed) $logger -p daemon.info -t pwrctl-local "lid-closed $2" ;; lid-opened) $logger -p daemon.info -t pwrctl-local "lid-opened $2" ;; sleep) $logger -p daemon.info -t pwrctl-local "sleep $2" ;; wakeup) $logger -p daemon.info -t pwrctl-local "sleep $2" ;; *) $logger -p daemon.error -t pwrctl-local "invalid arg $1 $2" exit 2 ;; esac exit 0