#!/bin/sh
# Assign ownership of the console to the invoking user
#
# 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.
#
chown $USER /dev/console

# Get rid of all clients started by Xsetup
xwininfo -root -children | grep '  0x' | cut -d' ' -f6 | xargs -n1 xkill -id

# Register a login (derived from GiveConsole as follows:)
exec /usr/bin/sessreg  -a -w /var/log/wtmp -u /var/run/utmp -x /etc/X11/xdm/Xservers -l $DISPLAY -h "" $USER

