summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-libs/libnjb/files/nomadjukebox')
-rw-r--r--media-libs/libnjb/files/nomadjukebox35
1 files changed, 35 insertions, 0 deletions
diff --git a/media-libs/libnjb/files/nomadjukebox b/media-libs/libnjb/files/nomadjukebox
new file mode 100644
index 000000000000..bc6c9e32d64c
--- /dev/null
+++ b/media-libs/libnjb/files/nomadjukebox
@@ -0,0 +1,35 @@
+#!/bin/sh
+# Lifts a plugged in nomad jukebox to user space and
+# optionally runs a client program.
+# Written by Linus Walleij 2004, based on the "usbcam"
+# script by Nalin Dahyabhai.
+DEVICEOWNER=CONSOLE
+DEVICEPERMS=0600
+PROGRAM="cd ~; gnomad2 --display=localhost:0"
+
+if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
+then
+ # New code, using lock files instead of copying /dev/console permissions
+ # This also works with non-gdm logins (e.g. on a virtual terminal)
+ # Idea and code from Nalin Dahyabhai <nalin@redhat.com>
+ if [ "x$DEVICEOWNER" = "xCONSOLE" ]
+ then
+ if [ -f /var/run/console.lock ]
+ then
+ DEVICEOWNER=`cat /var/run/console.lock`
+ elif [ -f /var/lock/console.lock ]
+ then
+ DEVICEOWNER=`cat /var/lock/console.lock`
+ else
+ DEVICEOWNER=
+ fi
+ fi
+ if [ -n "$DEVICEOWNER" ]
+ then
+ chmod 0000 "${DEVICE}"
+ chown "${DEVICEOWNER}" "${DEVICE}"
+ chmod "${DEVICEPERMS}" "${DEVICE}"
+ # Then run an optional program - this does not work yet.
+ # su "${CONSOLEOWNER}" -c "${PROGRAM}"
+ fi
+fi