~ubuntu-branches/ubuntu/hardy/gnomad2/hardy

« back to all changes in this revision

Viewing changes to nomadjukebox

  • Committer: Bazaar Package Importer
  • Author(s): Shaun Jackman
  • Date: 2004-10-25 10:24:21 UTC
  • Revision ID: james.westby@ubuntu.com-20041025102421-hnnl6uzlkutcibvi
Tags: upstream-2.5.0
ImportĀ upstreamĀ versionĀ 2.5.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# Lifts a plugged in nomad jukebox to user space and
 
3
# optionally runs a client program.
 
4
# Written by Linus Walleij 2004, based on the "usbcam"
 
5
# script by Nalin Dahyabhai.
 
6
DEVICEOWNER=CONSOLE
 
7
DEVICEPERMS=0600
 
8
PROGRAM="cd ~; gnomad2 --display=localhost:0"
 
9
 
 
10
if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
 
11
then
 
12
    # New code, using lock files instead of copying /dev/console permissions
 
13
    # This also works with non-gdm logins (e.g. on a virtual terminal)
 
14
    # Idea and code from Nalin Dahyabhai <nalin@redhat.com>
 
15
    if [ "x$DEVICEOWNER" = "xCONSOLE" ]
 
16
    then
 
17
        if [ -f /var/run/console.lock ]
 
18
        then
 
19
            DEVICEOWNER=`cat /var/run/console.lock`
 
20
        elif [ -f /var/lock/console.lock ]
 
21
        then
 
22
            DEVICEOWNER=`cat /var/lock/console.lock`
 
23
        else
 
24
            DEVICEOWNER=
 
25
        fi
 
26
    fi
 
27
    if [ -n "$DEVICEOWNER" ]
 
28
    then
 
29
        chmod 0000 "${DEVICE}"
 
30
        chown "${DEVICEOWNER}" "${DEVICE}"
 
31
        chmod "${DEVICEPERMS}" "${DEVICE}"
 
32
        # Then run an optional program - this does not work yet.
 
33
        # su "${CONSOLEOWNER}" -c "${PROGRAM}"
 
34
    fi
 
35
fi