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
|
#!/bin/sh
# INIT script to check whether we're on batteries, and so start with laptop
# mode etc enabled.
### BEGIN INIT INFO
# Provides: acpi-support
# Required-Start: $local_fs $remote_fs $syslog
# Required-Stop: $local_fs $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 1
# Short-Description: Start some power management scripts
### END INIT INFO
test -f /usr/share/acpi-support/power-funcs || exit 0
# BUGS: unless we start *really* late, we have no way of throttling
# xscreensaver, since it won't be there to command.
. /usr/share/acpi-support/power-funcs
test -f /lib/lsb/init-functions || exit 1
. /lib/lsb/init-functions
test -d /var/lib/acpi-support || exit 0
case "$1" in
start)
log_action_begin_msg "Enabling power management"
on_ac_power
if [ $? -eq 1 ]; then
/etc/acpi/power.sh true
fi
# Source everything in /etc/acpi/start.d/
for SCRIPT in /etc/acpi/start.d/*.sh; do
if [ -f "$SCRIPT" ] ; then
. "$SCRIPT"
fi
done
log_action_end_msg 0
;;
stop)
log_action_begin_msg "Disabling power management"
on_ac_power
if [ $? -eq 1 ]; then
/etc/acpi/power.sh false
fi
log_action_end_msg 0
;;
restart|force-reload|status)
# Doesn't make sense for this package
;;
*)
;;
esac
|