11.1Sjmcneill#!/bin/sh - 21.1Sjmcneill# 31.2Schristos# $NetBSD: hotkey_button,v 1.2 2008/01/17 00:37:46 christos Exp $ 41.1Sjmcneill# 51.1Sjmcneill# Generic script for hotkey events. 61.1Sjmcneill# 71.1Sjmcneill# Arguments passed by powerd(8): 81.1Sjmcneill# 91.1Sjmcneill# hotkey event 101.1Sjmcneill 111.1SjmcneillPATH=/usr/pkg/bin:$PATH; export PATH 121.1Sjmcneill 131.1Sjmcneill# XXXJDM need a better way to determine this 141.1SjmcneillXUSER="$(ls -l /dev/console | awk '{ print $3; }')" 151.1SjmcneillDISPLAY=:0.0; export DISPLAY 161.1Sjmcneill 171.1Sjmcneillcase "${2}" in 181.1Sjmcneillpressed) 191.1Sjmcneill if [ -f "/etc/powerd/actions/${1}" ]; then 201.2Schristos /usr/bin/su -- "$XUSER" -c "/etc/powerd/actions/${1}" 211.1Sjmcneill fi 221.1Sjmcneill exit 0 231.1Sjmcneill ;; 241.1Sjmcneillreleased) 251.1Sjmcneill ;; 261.1Sjmcneill*) 271.1Sjmcneill logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1 281.1Sjmcneill exit 1 291.1Sjmcneillesac 30