Well, following a kernel upgrade to version 2.6.25, that script stopped working (see bug #473629). Here's a (debian-specific-works-on-my-machine) replacement script, based on the output of acpi:
# this is a drop-in replacement for /usr/bin/on_ac_power
if [ -x /usr/bin/acpi ]; then
status=$(/usr/bin/acpi -aB | cut -d' ' -f 6)
case "$status" in
Note that I'm assuming that the system has a single AC power supply.