Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / etc / powerd / scripts / hotkey_button
blob46e3b5287d7a8c54a313cca49e0b554792c294d8
1 #!/bin/sh -
3 # $NetBSD: hotkey_button,v 1.1 2007/12/22 19:04:11 jmcneill Exp $
5 # Generic script for hotkey events.
7 # Arguments passed by powerd(8):
9 # hotkey event
11 PATH=/usr/pkg/bin:$PATH; export PATH
13 # XXXJDM need a better way to determine this
14 XUSER="$(ls -l /dev/console | awk '{ print $3; }')"
15 DISPLAY=:0.0; export DISPLAY
17 case "${2}" in
18 pressed)
19 if [ -f "/etc/powerd/actions/${1}" ]; then
20 /usr/bin/su -- "$XUSER" -c "/etc/powerd/actions/${1}"
22 exit 0
24 released)
27 logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1
28 exit 1
29 esac