# ~/.profile: executed by Bourne-compatible login shells.

if [ "$BASH" ]; then
  if [ -f ~/.bashrc ]; then
    . ~/.bashrc
  fi
fi

mesg n

export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_PLUGINDIR=/lib/ts
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_CALIBFILE=/etc/pointercal

s3='TSLIB_TSDEVICE=/dev/input/event'
s4='QWS_MOUSE_PROTO=Tslib:/dev/input/event'

s1=$(cat /proc/bus/input/devices | grep -A4 'TouchController"')

s5=${s1##*event}

s2=`expr ${s5}`

export ${s3}${s2}
export ${s4}${s2}

cd /root/bin-AOI

file="newupdate.tar.gz"
tardir="./newupdate"
cammerdir="cammer*"
fileupdate="./update.sh"
if [ -f $file ]
then
  rm -rf $tardir 
  mkdir $tardir
  tar -zxvf $file -C $tardir
  chmod -R 777 *
  if ls $tardir/$cammerdir > $tardir/cam 2>&1;then
    rm -rf $cammerdir
    rm -rf $tardir/cam
  fi
  cp -rf $tardir/* ./
  if [ -f $fileupdate ]
  then
    $fileupdate
    cd /root/bin-AOI
    rm -f $fileupdate
  fi
  rm -f $file
  rm -rf $tardir 
fi

python3.4 ./cnt_net/upnetcard.py

mknod /dev/led c 233 0
insmod led.ko

sleep 6s

./application -qws

