#!/bin/sh # prints out the name of the kiosk user to log in as; # e.g., if $DISPLAY is "kiosk07.dnalounge.net:0.0", then # the user will be "guest07". # # In /etc/X11/gdm/gdm.conf use: # AutomaticLogin=/usr/local/sbin/kioskname| # TimedLogin=/usr/local/sbin/kioskname| # Kludge for debugging on the primary console. if ( echo $DISPLAY | grep '^:0\(\.0\)*$' >/dev/null 2>/dev/null ) ; then echo guest07 exit 0 fi # handle IP addresses in $DISPLAY, like 172.28.4.65:6 # NN=`echo $DISPLAY | sed -n 's/^[0-9.]*\.\([0-9]*\):[0-9]*$/\1/p'` if [ "x$NN" != "x" ]; then NN=`echo $NN - 64 | bc | sed 's/^\([0-9]\)$/0\1/'` echo "guest$NN" exit 0 fi if ! ( echo $DISPLAY | grep '^kiosk[0-9]' >/dev/null 2>/dev/null ) ; then echo "$0: bogus DISPLAY: $DISPLAY" >&2 exit 1 fi echo $DISPLAY | sed -e 's/:.*//' -e 's/\..*//' -e 's/kiosk/guest/'