#!/bin/sh
# This is developer test

/bin/mount -a

PATH=/usr/bin:/usr/sbin:/bin:/sbin
LD_LIBRARY_PATH="/usr/local/lib:/usr/lib:/usr/lib/rsupport:/usr/lib/media:/usr/lib/sensor:/usr/local/Trolltech/QtEmbedded-4.8.5-arm/lib:/lib/ts"
QT_QWS_FONTDIR=/lib/qt

export PATH
export LD_LIBRARY_PATH
export QT_QWS_FONTDIR

/etc/init.d/permission.sh


echo "

        ======  RSupport ======

         RVBOX Version 0.0.1

"
CONFIGS_FILE=/configs/configs.ini
if [ ! -e $CONFIGS_FILE ]; then
    cp /etc/default_configs.ini $CONFIGS_FILE
fi

CONFIGS_NETWORK_FILE=/configs/configs_network.ini
if [ ! -e $CONFIGS_NETWORK_FILE ]; then
    cp /etc/default_configs_network.ini $CONFIGS_NETWORK_FILE
fi

cd /usr/lib/ko
SENSOR_NAME=`property_get Sensor name`
if [ "$SENSOR_NAME" = "null" ];then
        SENSOR_NAME=lt6911uxc
fi
./load3519av100 -a -sensor0 $SENSOR_NAME
insmod leds-aw20198.ko
/usr/local/bin/ledani &
/etc/m_led_off.sh

#insmod /usr/lib/88x2cs.ko
country=`property_get Network country`
if [ "$country" = "jp" ]; then
        echo "wifi module - country jp"
        insmod  /usr/lib/88x2cs_jp.ko rtw_channel_plan=75
else
        echo "wifi module - country ko"
        insmod  /usr/lib/88x2cs_kr.ko rtw_channel_plan=125
fi


for initscript in /etc/init.d/S[0-3][0-9]*
do
        if [ -x $initscript ] ;
        then
                echo "[RCS]: $initscript"
                $initscript
        fi
done

mkdir /dev/shm          # for jpeg snapshot

cd /usr/lib/ko
SENSOR_NAME=`property_get Sensor name`
if [ "$SENSOR_NAME" = "null" ];then
        SENSOR_NAME=lt6911uxc
fi
#./load3519av100 -a -sensor0 $SENSOR_NAME
#insmod leds-aw20198.ko
#/usr/local/bin/ledani
cd /etc/
#./a_led_inti.sh
#./m_led_off.sh
#./fan.sh 6

#cd /usr/lib/
#insmod 88x2cs.ko
cd

for initscript in /etc/init.d/S[5-9][0-9]*
do
        if [ -x $initscript ] ;
        then
                echo "[RCS]: $initscript start"
                $initscript start
        fi
done

cd /usr/local/bin
#./hifb_qt &
#./gpio_ctl 1 &
cd ~

touch /tmp/bootup # for boot up event

/etc/init.d/iwatcher.sh &
/etc/openssh/sbin/sshd &
/etc/init.d/app.sh &
/etc/init.d/restore_package.sh &

