#!/bin/sh

export SERIAL=`/usr/sbin/fw_printenv | grep serial# | cut -d '=' -f2`
export QT_QPA_PLATFORM=linuxfb
export QT_QPA_GENERIC_PLUGINS=evdevtouch
export QT_QPA_FONTDIR=/usr/share/fonts/dejavu
export QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=/dev/input/touchscreen0

DIR="$(cd $(dirname $0) && pwd)"

cd $DIR

touch /tmp/.app_started

while true
do
  #echo "bglight:255" > /proc/driver/video

  while [ -e /tmp/.app_dont_start ]
  do
    sleep 1
  done

if [ -f tixneterminal3new ]
then
	rm -f tixneterminal3
	mv tixneterminal3new tixneterminal3
	chmod +x tixneterminal3
fi

  ./tixneterminal3 > /dev/null 2>&1

  if [ $? != "0" ]
  then
    sleep 5
  else
    sleep 1
  fi
  killall -9 tixneterminal3
done
