sleep_button revision 1.8
11.1Smycroft#!/bin/sh - 21.1Smycroft# 31.8Splunky# $NetBSD: sleep_button,v 1.8 2011/05/27 09:28:42 plunky Exp $ 41.1Smycroft# 51.3Sjmcneill# Generic script for sleep button events. 61.1Smycroft# 71.1Smycroft# Arguments passed by powerd(8): 81.1Smycroft# 91.1Smycroft# device event 101.1Smycroft 111.1Smycroftcase "${2}" in 121.3Sjmcneillpressed) 131.7Sjruoho 141.8Splunky /etc/rc.d/bluetooth stop 151.3Sjmcneill /etc/rc.d/ntpd stop 161.3Sjmcneill /etc/rc.d/dhclient stop 171.3Sjmcneill /etc/rc.d/network stop 181.4Sjmcneill /etc/rc.d/wpa_supplicant stop 191.7Sjruoho 201.7Sjruoho if /sbin/sysctl hw.acpi.sleep.state >/dev/null 2>&1; then 211.7Sjruoho /sbin/sysctl -w hw.acpi.sleep.state=3 221.3Sjmcneill else 231.4Sjmcneill sleep 1 241.6Sabs if /etc/rc.d/apmd onestatus >/dev/null ; then 251.4Sjmcneill /usr/sbin/apm -z 261.4Sjmcneill else 271.4Sjmcneill /usr/sbin/apm -d -z 281.4Sjmcneill fi 291.4Sjmcneill # ... waking up 301.4Sjmcneill sleep 1 311.3Sjmcneill fi 321.7Sjruoho 331.4Sjmcneill /etc/rc.d/wpa_supplicant start 341.3Sjmcneill /etc/rc.d/network start 351.3Sjmcneill /etc/rc.d/dhclient start 361.3Sjmcneill /etc/rc.d/ntpdate start 371.3Sjmcneill /etc/rc.d/ntpd start 381.8Splunky /etc/rc.d/bluetooth start 391.3Sjmcneill ;; 401.7Sjruoho 411.3Sjmcneillreleased) 421.3Sjmcneill # Note that we don't really need to handle a released event here, 431.3Sjmcneill # so we can gracefully exit. 441.3Sjmcneill ;; 451.1Smycroft*) 461.3Sjmcneill logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1 471.1Smycroft exit 1 481.1Smycroft ;; 491.1Smycroftesac 50