I recently installed Ubuntu Dapper and found that gnomad2 would not
work for me due to the problem described in this bug. Here is my new
script version which works for both the hotplug system and udev, I
think.
Changes:
1) permissions for root:audio should be 0660, not 0666.
2) if DEVICE is not set but DEVNAME is, use DEVNAME
3) allow specified device to be either a regular file or a character device
--Brandon Williams
#!/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=root:audio
DEVICEPERMS=0660
PROGRAM="cd ~; gnomad2 --display=localhost:0"
[[ -z "${DEVICE}" && -n "${DEVNAME}" ]] && DEVICE="${DEVNAME}"
# Special quirk for SuSE systems using "resmgr"
# (see http://rechner.lst.de/~okir/resmgr/)
if [ -f /sbin/resmgr ]
then
/sbin/resmgr "${ACTION}" "${DEVICE}" desktop usb
exit 0
fi
# This is for most other distributions
if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" -o -c "${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 <[EMAIL PROTECTED]>
if [ "x$DEVICEOWNER" = "xCONSOLE" ]
then
if [ -f /var/run/console/console.lock ]
then
DEVICEOWNER=`cat /var/run/console/console.lock`
elif [ -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="nobody"
DEVICEPERMS="0666"
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