File: pmcs-pmud

package info (click to toggle)
pbbuttonsd 0.7.9-5
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,416 kB
  • ctags: 2,350
  • sloc: ansic: 17,517; sh: 4,626; makefile: 552; yacc: 288; cpp: 203; sed: 16
file content (57 lines) | stat: -rwxr-xr-x 1,521 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
#
# This script is invoked by pmud to configure the system for a
# given power level. The desired level is indicated by the first
# argument and can take the following values:
#
# minimum    = minimum power
# medium     = medium power 
# maximum    = full power  
# lid-opened = cover has been opened
# lid closed = cover has been closed
# sleep      = prepare for sleep
# wakeup     = system woke up after a sleep
# warning    = low battery condition detected, issue a warning to users
#
# the second argument gives the current power source, and can take the
# following values:
#
# ac
# battery
#

PATH=/bin:/sbin:/usr/bin:/usr/sbin
[ -x logger ] && \
	logger -p daemon.info -t pmcs-pmud "called with $1 $2"

cd `dirname $0`

case "$1" in
  warning)
    wall "Low battery - system will go down now!"
    ;;
  minimum)
    run-parts --arg="powersave" --arg="$2" event.d
    ;;
  medium)
    run-parts --arg="custom" --arg="$2" event.d
    ;;
  maximum)
    run-parts --arg="performance" --arg="$2" event.d
    ;;
  lid-opened)
    run-parts --arg="cover-open" --arg="$2" --arg="open" event.d
    ;;
  lid-closed)
    run-parts --arg="cover-close" --arg="$2" --arg="close" event.d
    ;;
  sleep)
    [ -d suspend.d ] && run-parts --arg="suspend" --arg="$2" --arg="ram" suspend.d
    run-parts --arg="suspend" --arg="$2" --arg="ram" event.d
    ;;
  wakeup)
    [ -d resume.d ] && run-parts --arg="resume" --arg="$2" --arg="ram" resume.d
    run-parts --arg="resume" --arg="$2" --arg="ram" event.d
    ;;
esac