Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 380933
Collapse All | Expand All

(-)openrc-0.8.2.orig/scripts/on_ac_power (-4 / +4 lines)
Lines 3-16 Link Here
3
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
3
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
4
4
5
# Exit 0 if on AC power, 1 if not and 255 if we don't know how to work it out
5
# Exit 0 if on AC power, 1 if not and 255 if we don't know how to work it out
6
if [ -f /proc/acpi/ac_adapter/AC*/state ]; then
6
if [ -f /proc/acpi/ac_adapter/*/state ]; then
7
	cat /proc/acpi/ac_adapter/AC*/state | while read line; do
7
	cat /proc/acpi/ac_adapter/*/state | while read line; do
8
		case "$line" in
8
		case "$line" in
9
		"state:"*"off-line") exit 128;;
9
		"state:"*"off-line") exit 128;;
10
		esac
10
		esac
11
	done
11
	done
12
elif [ -f /sys/class/power_supply/AC*/online ]; then
12
elif [ -f /sys/class/power_supply/*/online ]; then
13
	cat /sys/class/power_supply/AC*/online | while read line; do
13
	cat /sys/class/power_supply/*/online | while read line; do
14
		[ "${line}" = 0 ] && exit 128
14
		[ "${line}" = 0 ] && exit 128
15
	done
15
	done
16
elif [ -f /proc/pmu/info ]; then
16
elif [ -f /proc/pmu/info ]; then

Return to bug 380933