~ubuntu-branches/ubuntu/natty/vlock/natty

« back to all changes in this revision

Viewing changes to scripts/mplayer.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
# mplayer.sh -- mplayer pausing script for vlock,
 
3
#               the VT locking program for linux
 
4
#
 
5
# To use this script do run the following command
 
6
# $ mkfifo ~/.mplayer/control
 
7
# and add
 
8
# input=file=/home/<user>/.mplayer/control
 
9
# to your ~/.mplayer/config.
 
10
 
11
# This program is copyright (C) 2007 Frank Benkstein, and is free software.  It
 
12
# comes without any warranty, to the extent permitted by applicable law.  You
 
13
# can redistribute it and/or modify it under the terms of the Do What The Fuck
 
14
# You Want To Public License, Version 2, as published by Sam Hocevar.  See
 
15
# http://sam.zoy.org/wtfpl/COPYING for more details.
 
16
 
 
17
set -e
 
18
 
 
19
DEPENDS="all"
 
20
 
 
21
hooks() {
 
22
  while read hook_name ; do
 
23
    case "${hook_name}" in
 
24
      vlock_start)
 
25
        if fuser "${HOME}/.mplayer/control" > /dev/null 2>&1 ; then
 
26
          echo "pausing seek -4" > "${HOME}/.mplayer/control"
 
27
        fi
 
28
      ;;
 
29
      vlock_end)
 
30
        if fuser "${HOME}/.mplayer/control" > /dev/null 2>&1 ; then
 
31
          echo "pause" > "${HOME}/.mplayer/control"
 
32
        fi
 
33
      ;;
 
34
    esac
 
35
  done
 
36
}
 
37
 
 
38
if [ $# -ne 1 ] ; then
 
39
  echo >&2 "Usage: $0 <command>"
 
40
  exit 1
 
41
fi
 
42
 
 
43
case "$1" in
 
44
  hooks)
 
45
    hooks
 
46
  ;;
 
47
  preceeds)
 
48
    echo "${PRECEEDS}"
 
49
  ;;
 
50
  succeeds)
 
51
    echo "${SUCCEEDS}"
 
52
  ;;
 
53
  requires)
 
54
    echo "${REQUIRES}"
 
55
  ;;
 
56
  needs)
 
57
    echo "${NEEDS}"
 
58
  ;;
 
59
  depends)
 
60
    echo "${DEPENDS}"
 
61
  ;;
 
62
  conflicts)
 
63
    echo "${CONFLICTS}"
 
64
  ;;
 
65
  *)
 
66
    echo >&2 "$0: unknown command '$1'"
 
67
    exit 1
 
68
  ;;
 
69
esac