aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-05-29 21:19:31 +0100
committerRoy Marples <roy@marples.name>2009-05-29 21:19:31 +0100
commite689f17933a5b235c5863b3c2c385b8ebf727395 (patch)
tree07c1b64f89ae7a75875dc5547ea0a81a6c743ce7
parentfa9e482a31719d5fd647a183f1f844e596db6acf (diff)
Support NetBSD envstat for working out if on AC power.
-rw-r--r--init.d/fsck.in13
1 files changed, 10 insertions, 3 deletions
diff --git a/init.d/fsck.in b/init.d/fsck.in
index af2b8fbe..8cf194bc 100644
--- a/init.d/fsck.in
+++ b/init.d/fsck.in
@@ -35,19 +35,26 @@ _on_ac_power()
if [ -f /proc/acpi/ac_adapter/AC/state ]; then
cat /proc/acpi/ac_adapter/AC/state | while read line; do
case "$line" in
- "state:"*"on-line") return 128;;
+ "state:"*"off-line") return 128;;
esac
done
elif [ -f /proc/pmu/info ]; then
cat /proc/pmu/info | while read line; do
case "$line" in
- "AC Power"*": 1") return 128;;
+ "AC Power"*": 0") return 128;;
+ esac
+ done
+ elif type envstat >/dev/null 2>&1; then
+ # NetBSD has envstat
+ envstat -d acpiacad0 2>/dev/null | while read line; do
+ case "$line" in
+ "connected:"*"OFF") return 128;;
esac
done
else
return 0
fi
- [ $? = 128 ]
+ [ $? != 128 ]
}
start()