#!/bin/sh
. /conf/tcos.conf
. /conf/tcos-run-functions
SERVER=$(read_server "xdmcp-server")
export DISPLAY=:0
export HOME=/root
export USER_NX_DIR=/root/.nx

if [ -x /usr/bin/ssh ]; then
  ssh -N -p 2022 -l mario -C -2 -L 5000:localhost:2022 
fi

if [ -f $\XAUTHORITY ]; then
  TCOS_XORG_OPTS="$TCOS_XORG_OPTS -auth $XAUTHORITY"
fi

/sbin/tryXorg  --xorgopts="${TCOS_XORG_OPTS}" &

waitforX
sleep 1

# no window manager for freenx
#twm  >> /tmp/initramfs.debug 2>&1 &

sleep 2
# set background color
xsetroot -cursor_name left_ptr -solid "#338899"

/usr/NX/bin/nxclient  >> /tmp/initramfs.debug 2>&1
xterm

