#!/bin/sh
#

QTDIR=/usr/lib/qt
QWS_MOUSE_PROTO=None
#QWS_DISPLAY=VGA16:0
#QWS_SIZE=640x480
#QWS_SIZE=800x600
QWS_SIZE=`fbset -r`
#QWS_SIZE=1024x768
#if [ ! -w /dev/psaux ]
#then
#QWS_MOUSE_PROTO=IntelliMouse:/dev/psaux
#else
#QWS_MOUSE_PROTO=None
#fi

#QWS_MOUSE_PROTO=Auto

export QWS_MOUSE_PROTO QTDIR QWS_DISPLAY QWS_SIZE

cd /home


cbf="./conf.beg"
cef="./conf.end"
RES=0

if [ -e ./wl4d.o ]
then
      insmod ./wl4d.o
fi	    


if [ -e $cbf -a -x $cbf ]
then
 echo "Execute begin script!"
 $doit $cbf

 echo "Remove script"
 mount /home -o remount,rw
 rm -f $cbf
 sync
 mount /home -o remount,ro
fi

while true
do

clear
 
./wlchoice -d /home -p 0 -b 16 -k 0

case $? in
 0 )  echo "WL4"
      ./wlx3
      RES=$?
      break;
            ;;
 1 )  echo "shell"
      /bin/sh 
            ;;
 2 )  echo "deco"
      dx
      break
            ;;
 3 )  echo ""
            ;;	    
 4 )  echo "     !!!"
      mount /home -o remount,rw
        ./sys
      mount /home -o remount,ro
            ;;
 5 )  echo "Start WL this test automatic"
        ./wlx3 --wlca=wlca.test
      break
            ;;
 6 )
      mount /home -o remount,rw
        ./unvram r nvram.bin 80 48
      mount /home -o remount,ro
	    ;;
 7 )  setclock
            ;;	    
 9 )  break
	    ;;
 * )  echo "deco"
      dx
      break
            ;;
esac 

done

if [ -e $cef -a -x $cef ]
then
 echo "Execute end script!"
 $doit $cef

 echo "Remove script"
 mount /home -o remount,rw
 rm -f $cef
 sync
 mount /home -o remount,ro
 
fi

sync
