contrib/acpid/default.sh

33 lines
612 B
Bash
Raw Normal View History

2006-11-13 21:01:22 +01:00
#!/bin/sh
2021-02-04 23:50:45 +01:00
#@ Default acpi script that takes an entry for all actions
log() {
2021-02-08 23:56:12 +01:00
logger -t /etc/acpi/default.sh "${*}"
2021-02-04 23:50:45 +01:00
}
2006-11-13 21:01:22 +01:00
unhandled() {
t=${1}
shift
log "ACPI: no handler for event ${t}, data: ${*}"
}
2021-02-08 23:56:12 +01:00
set ${*}
2006-11-13 21:01:22 +01:00
# In order to not cumulate actions of ACPI event they should be detached via
# ( ACTION ) </dev/null >/dev/null 2>&1 &
# (At least setting volume or other things which depend on hardware which might
# block and cause the script not to return for a while.)
2021-02-08 23:56:12 +01:00
case "${1}" in
2021-02-04 23:50:45 +01:00
button/power)
2021-02-08 23:56:12 +01:00
case "${2}" in
PWRF)
/sbin/init 0;;
*)
unhandled "${#}: ${@}";;
2021-02-04 23:50:45 +01:00
esac
;;
*)
unhandled "${#}: $@";;
2006-11-13 21:01:22 +01:00
esac