-check_power(){
- # laptop check, on_ac_power returns:
- # 0 (true) System is on main power
- # 1 (false) System is not on main power
- # 255 (false) Power status could not be determined
- # Desktop systems always return 255 it seems
- if which on_ac_power >/dev/null 2>&1; then
- on_ac_power
- POWER=$?
- if [ $POWER -eq 1 ]; then
- debug_echo "exit: system NOT on main power"
- return 1
- elif [ $POWER -ne 0 ]; then
- debug_echo "power status ($POWER) undetermined, continuing"
- fi
- debug_echo "system is on main power."
- fi
- return 0
-}
-