~ubuntu-branches/ubuntu/maverick/vlock/maverick

« back to all changes in this revision

Viewing changes to scripts/example_script.sh

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Wirt
  • Date: 2008-06-17 17:13:25 UTC
  • mfrom: (1.1.2 upstream) (3.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080617171325-ic8yy6tol0165i96
Tags: 2.2.2-3
* Don't try to chgrp to "vlock" during build time (Closes: #486665)
* Bump standards version (No changes)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# example_script.sh -- example script for vlock,
 
3
#                      the VT locking program for linux
 
4
 
5
# This program is copyright (C) 2007 Frank Benkstein, and is free software.  It
 
6
# comes without any warranty, to the extent permitted by applicable law.  You
 
7
# can redistribute it and/or modify it under the terms of the Do What The Fuck
 
8
# You Want To Public License, Version 2, as published by Sam Hocevar.  See
 
9
# http://sam.zoy.org/wtfpl/COPYING for more details.
 
10
 
 
11
set -e
 
12
 
 
13
# Declare dependencies.  Please see PLUGINS for their meaning.  Empty
 
14
# dependencies can be left out.
 
15
PRECEEDS="new all"
 
16
# SUCCEEDS=""
 
17
# REQUIRES=""
 
18
# NEEDS=""
 
19
DEPENDS="all"
 
20
# CONFLICTS=""
 
21
 
 
22
 
 
23
hooks() {
 
24
  # The name of the hook that should be executed is read as a string from
 
25
  # stdin.  This function should only exit when stdin hits end-of-file.
 
26
 
 
27
  while read hook_name ; do
 
28
    case "${hook_name}" in
 
29
      vlock_start)
 
30
        # do something here that should happen at the start of vlock
 
31
      ;;
 
32
      vlock_end)
 
33
        # do something here that should happen at the end of vlock
 
34
      ;;
 
35
      vlock_save)
 
36
        # start a screensaver type action here
 
37
      ;;
 
38
      vlock_save_abort)
 
39
        # abort a screensaver type action here
 
40
      ;;
 
41
    esac
 
42
  done
 
43
}
 
44
 
 
45
# Everything below is boilerplate code that shouldn't need to be changed.
 
46
 
 
47
if [ $# -ne 1 ] ; then
 
48
  echo >&2 "Usage: $0 <command>"
 
49
  exit 1
 
50
fi
 
51
 
 
52
case "$1" in
 
53
  hooks)
 
54
    hooks
 
55
  ;;
 
56
  preceeds)
 
57
    echo "${PRECEEDS}"
 
58
  ;;
 
59
  succeeds)
 
60
    echo "${SUCCEEDS}"
 
61
  ;;
 
62
  requires)
 
63
    echo "${REQUIRES}"
 
64
  ;;
 
65
  needs)
 
66
    echo "${NEEDS}"
 
67
  ;;
 
68
  depends)
 
69
    echo "${DEPENDS}"
 
70
  ;;
 
71
  conflicts)
 
72
    echo "${CONFLICTS}"
 
73
  ;;
 
74
  *)
 
75
    echo >&2 "$0: unknown command '$1'"
 
76
    exit 1
 
77
  ;;
 
78
esac