#!/bin/bash
PATH=/usr/heimdal/bin:/usr/bin:/usr/X11R6/bin:$PATH
cd $HOME

# Cleanup from last run.
rm -rf /tmp/.X11-unix


# Startup the X Server, the twm window manager, and an xterm.

# Generate a cookie

test $XAUTHORITY || XAUTHORITY=${HOME}/.Xauthority
export XAUTHORITY
rm -f $XAUTHORITY

test $XLOGFILE || XLOGFILE=${HOME}/.xstart.log
export XLOGFILE

exec > $XLOGFILE 2>&1

IPNR=`ipconfig | grep 'IP Address' | cut -d: -f2`
FOO=$RANDOM
auth=$FOO$FOO`date +%S%S`$$$$           
xauth -i add $IPNR:0 . $auth
IPNAME=`xauth list | cut -d: -f1`
DISPLAY=$IPNAME:0
export DISPLAY

# Start the X Server.
/usr/X11R6/bin/XWin -auth $XAUTHORITY -fullscreen&
XWINPID=$!
# Wait for X server to come up
sleep 5

# do not ask why we do this
(xlogo & FOO=$! ; sleep 10 ; kill $FOO)& 
sleep 3

# Use swedish keyboard map
setxkbmap se

# One xterm for the easily confused
xterm &

# Start the fvwm window manager.
twm

# Kill the X-server
kill $XWINPID

# Return from sh.
exit

