Lines 1-39
Link Here
|
1 |
#!/bin/bash |
1 |
#!/sbin/runscript |
2 |
# INIT script to check whether we're on batteries, and so start with laptop |
2 |
# INIT script to check whether we're on batteries, and so start with laptop |
3 |
# mode etc enabled. |
3 |
# mode etc enabled. |
4 |
|
4 |
|
5 |
# BUGS: unless we start *really* late, we have no way of throttling |
5 |
# BUGS: unless we start *really* late, we have no way of throttling |
6 |
# xscreensaver, since it won't be there to command. |
6 |
# xscreensaver, since it won't be there to command. |
7 |
. /usr/share/acpi-support/power-funcs |
|
|
8 |
|
9 |
test -f /lib/lsb/init-functions || exit 1 |
10 |
. /lib/lsb/init-functions |
11 |
|
12 |
test -d /var/lib/acpi-support || exit 0 |
13 |
|
14 |
shopt -s nullglob |
15 |
|
16 |
case "$1" in |
17 |
start) |
18 |
log_begin_msg "Checking battery state..." |
19 |
if [ `echo /proc/acpi/ac_adapter/*` ]; then |
20 |
/etc/acpi/power.sh |
21 |
fi |
22 |
# Source everything in /etc/acpi/start.d/ |
23 |
for SCRIPT in /etc/acpi/start.d/*.sh; do |
24 |
. $SCRIPT |
25 |
done |
26 |
log_end_msg 0 |
27 |
;; |
28 |
stop) |
29 |
log_begin_msg "Disabling power management..." |
30 |
if [ `echo /proc/acpi/ac_adapter/*` ]; then |
31 |
/etc/acpi/power.sh stop |
32 |
fi |
33 |
log_end_msg 0 |
34 |
;; |
35 |
*) |
36 |
;; |
37 |
esac |
38 |
|
39 |
|
7 |
|
|
|
8 |
depend() { |
9 |
need acpid |
10 |
} |
11 |
|
12 |
start() { |
13 |
ebegin "Starting acpi-support" |
14 |
. /usr/share/acpi-support/power-funcs |
15 |
|
16 |
test -d /var/lib/acpi-support || eend 0 |
17 |
|
18 |
shopt -s nullglob |
19 |
|
20 |
ebegin "Checking battery state..." |
21 |
if [ `echo /proc/acpi/ac_adapter/*` ]; then |
22 |
/etc/acpi/power.sh |
23 |
fi |
24 |
# Source everything in /etc/acpi/start.d/ |
25 |
for SCRIPT in /etc/acpi/start.d/*.sh; do |
26 |
. $SCRIPT |
27 |
done |
28 |
eend 0 |
29 |
} |
30 |
|
31 |
stop() { |
32 |
ebegin "Disabling power management..." |
33 |
if [ `echo /proc/acpi/ac_adapter/*` ]; then |
34 |
/etc/acpi/power.sh stop |
35 |
fi |
36 |
eend 0 |
37 |
} |