Codebase list openrc / 761fe99
on_ac_power needs to exit not return bug #322037 Jory A. Pratt 13 years ago
1 changed file(s) with 6 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
55 if [ -f /proc/acpi/ac_adapter/AC*/state ]; then
66 cat /proc/acpi/ac_adapter/AC*/state | while read line; do
77 case "$line" in
8 "state:"*"off-line") return 128;;
8 "state:"*"off-line") exit 128;;
99 esac
1010 done
1111 elif [ -f /sys/class/power_supply/AC*/online ]; then
1212 cat /sys/class/power_supply/AC*/online | while read line; do
13 [ "${line}" = 0 ] && return 128
13 [ "${line}" = 0 ] && exit 128
1414 done
1515 elif [ -f /proc/pmu/info ]; then
1616 cat /proc/pmu/info | while read line; do
1717 case "$line" in
18 "AC Power"*": 0") return 128;;
18 "AC Power"*": 0") exit 128;;
1919 esac
2020 done
2121 elif type envstat >/dev/null 2>&1; then
2222 # NetBSD has envstat
2323 envstat -d acpiacad0 2>/dev/null | while read line; do
2424 case "$line" in
25 "connected:"*"OFF") return 128;;
25 "connected:"*"OFF") exit 128;;
2626 esac
2727 done
2828 elif sysctl -q hw.acpi.acline >/dev/null 2>/dev/null; then
2929 case $(sysctl -n hw.acpi.acline) in
30 0) return 1;;
31 *) return 0;;
30 0) exit 1;;
31 *) exit 0;;
3232 esac
3333 else
3434 exit 255