#!/bin/sh
# Assign ownership of the console to the invoking user
# $XConsortium: GiveConsole,v 1.2 93/09/28 14:29:20 gildea Exp $
#
# By convention, both xconsole and xterm -C check that the
# console is owned by the invoking user and is readable before attaching
# the console output.  This way a random user can invoke xterm -C without
# causing serious grief.
#

if [ -f /etc/nologin ] ; then
  [ -x /usr/X11R6/bin/xmessage ] && /usr/X11R6/bin/xmessage \
	-file /etc/nologin -timeout 10 -default okay -center
  [ "$UID" != "0" ] && exit 1
fi

chown ${USER}:tty /dev/console /dev/tty0
touch -c /dev/console /dev/tty0

exec sessreg -a -l $DISPLAY $USER
