#!/bin/sh

if [  ! -d /mnt/hd/qtbin ]; then
mkdir /mnt/hd/qtbin
cp /opt/Qtopia/bin/* /mnt/hd/qtbin
if [ -e /mnt/hd/user/zknights/zknights ]; then cp /mnt/hd/user/zknights/zknights /mnt/hd/qtbin/zknights; fi
rm -r /mnt/hd/qtbin/qpe /mnt/hd/qtbin/qpe-reorgfiles /mnt/hd/qtbin/qss /mnt/hd/qtbin/qtopia-addmimetype /mnt/hd/qtbin/qtopia-stop-internal /mnt/hd/qtbin/qtopia-update-symlinks /mnt/hd/qtbin/qcop
fi

/mnt/hd/user/filebrowser qtbin/
fbselfile=`cat /var/run`
echo $fbselfile
if [ ! "$fbselfile" = "" ]; then

/mai/fbio /dev/fb1 enable 0
/mai/fbio /dev/fb0 enable 1
/mai/fbio /dev/fb0 format 6 0 1

export HOME=/mnt/hd/Qtopia
export QTDIR=/opt/Qtopia
export QPEDIR=/opt/Qtopia
export LD_LIBRARY_PATH=$QTDIR/lib:$QPEDIR/lib
export PATH=$PATH:$QPEDIR/bin

export QWS_DISPLAY=LinuxFb:/dev/fb0
export QWS_MOUSE_PROTO=TPanel:/dev/ts

$fbselfile -qws
/mai/fbio /dev/fb0 format 13 0 0

fi

if [ -f /var/run ]; then
rm /var/run
fi
