#!/bin/bash
#
# Supplement to apmscript - do things that apmscript doesn't do
# on startup or power status change - like remounting root noatime
# to allow spindown when on battery power
#
# 2004.11.03 Bill Waddington <william.waddington@beezmo.com>
# 2004.11.11 check power at resume

# check power status and do the appropriate thing
check_power()
    if apm | LC_ALL=C grep -q on-line &>/dev/null
    then
        mount -o remount,defaults /
    else
        mount -o remount,defaults,noatime /
    fi

# always check power status on start, resume, or change power
case $1 in
    resume)
        check_power
        ;;
    start)
        check_power
        ;;
    change)
        case $2 in
        power)
            check_power
            ;;
        esac
        ;;
    esac