1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
#!/bin/sh
#
# This shell script is called by the APM daemon (apmd) when the state
# of any power management function has changed. The exact events that
# trigger the calling of apmd_proxy depend on how apmd was configured
# at compile time.
#
# Here are the calling sequences for apmd_proxy:
#
# apmd_proxy start - APM daemon has started
# apmd_proxy stop - APM daemon is shutting down
# apmd_proxy suspend system - APM system has requested suspend mode
# apmd_proxy suspend critical - APM system indicates critical suspend
# apmd_proxy standby system - APM system has requested standby mode
# apmd_proxy suspend user - User has requested suspend mode
# apmd_proxy standby user - User has requested standby mode
# apmd_proxy resume suspend - System has resumed from suspend mode
# apmd_proxy resume standby - System has resumed from standby mode
# apmd_proxy resume critical - System has resumed from critical suspend
# apmd_proxy change battery - APM system reported low battery
# apmd_proxy change power - APM system reported AC/battery change
# apmd_proxy change time - APM system reported need for time update
# apmd_proxy change capability - APM system reported config. change
#
PATH=/bin:/sbin:/usr/bin:/usr/sbin
on_ac_power >/dev/null && PWR=ac || PWR=battery
cd `dirname $0`
case "$1" in
start)
if [ "$PWR" == "battery" ]; then
run-parts --arg="powersave" --arg="$PWR" event.d
else
run-parts --arg="performance" --arg="$PWR" event.d
fi
;;
change)
case "$2" in
battery)
wall "Low battery - system will go down now!"
;;
power)
if [ "$PWR" == "battery" ]; then
run-parts --arg="powersave" --arg="$PWR" event.d
else
run-parts --arg="performance" --arg="$PWR" event.d
fi
;;
esac
;;
suspend|standby)
[ -d suspend.d ] && run-parts --arg="suspend" --arg="$PWR" --arg="ram" suspend.d
run-parts --arg="suspend" --arg="$PWR" --arg="ram" event.d
;;
resume)
[ -d resume.d ] && run-parts --arg="resume" --arg="$PWR" --arg="ram" resume.d
run-parts --arg="resume" --arg="$PWR" --arg="ram" event.d
;;
esac
|