#!/bin/bash # ConsoleKit script to grant/revoke access to particular devices. # Author: Jim Carter , UCLA-Mathnet # The devices currently giving us trouble are the nVidia and ATI direct # rendering interfaces. These fail to create any sysfs data, and hence # HAL does not recognize them as video devices for which the console user # should get permission. # Warning, this script contains bash-isms. Debian rules require that scripts # run on any shell. if [ "$CK_SESSION_X11_DISPLAY" != ":0" ] ; then exit 0 ; fi reason="$1" case "$reason" in session_added ) luser=$CK_SESSION_USER_UID ; ;; session_removed ) luser=root ; ;; * ) exit 0 ; ;; esac if [ -z "$luser" ] ; then logger -p daemon.error "$0: CK_SESSION_USER_UID env variable was not set" exit 4 fi shopt -s nullglob devs=`echo /dev/nvidia* /dev/dri/*` if [ -z "$devs" ] ; then exit 0 ; fi logger -p daemon.error "$0: chown $luser $devs" chown $luser $devs