Merge branch 'canoe' into vlock-2
[vlock.git] / scripts / powerbook_backlight.sh
bloba86ae8f7b39be2d4796c414d990f2faa23e695ce
1 #!/bin/sh
2 ###########################################################################
3 # powerbook_backlight.sh, version 0.1.1
4 # 2007-10-15
6 # This vlock plugin script switches off the backlight on Apple Powerbook
7 # laptops while locking. It requires the fblevel utility to be installed.
9 # Copyright (C) 2007 Rene Kuettner <rene@bitkanal.net>
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License as
13 # published by the Free Software Foundation; version 2.
15 # This program is distributed in the hope that it will be useful, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23 # 02111-1307 USA
25 ###########################################################################
27 set -e
29 DEPENDS="all"
31 hooks() {
32 while read hook_name ; do
33 case "${hook_name}" in
34 vlock_save)
35 sudo fblevel off >/dev/null
37 vlock_save_abort)
38 sudo fblevel on >/dev/null
40 esac
41 done
44 if [ $# -ne 1 ] ; then
45 echo >&2 "Usage: $0 <command>"
46 exit 1
49 case "$1" in
50 hooks)
51 hooks
53 preceeds)
54 echo "${PRECEEDS}"
56 succeeds)
57 echo "${SUCCEEDS}"
59 requires)
60 echo "${REQUIRES}"
62 needs)
63 echo "${NEEDS}"
65 depends)
66 echo "${DEPENDS}"
68 conflicts)
69 echo "${CONFLICTS}"
72 echo >&2 "$0: unknown command '$1'"
73 exit 1
75 esac