#! /bin/sh
export LD_LIBRARY_PATH=/mnt/others/lib:/lib:/usr/lib
export PATH=/mnt/others/sbin:/bin:/sbin:/usr/bin:/usr/sbin
export XTABLES_LIBDIR=/mnt/others/lib
export IPTABLES_LIB_DIR=/mnt/others/lib
export IP6TABLES_LIB_DIR=/mnt/others/lib
export ALSA_CONFIG_PATH=/usr/share/alsa/alsa.conf
export OPENSSL_CONF=/mnt/others/sbin

KER_VER=`uname -r`

echo /sbin/mdev > /proc/sys/kernel/hotplug
mkdir -p /dev/shm
mkdir -p /dev/pts

mount -a
mdev -s

. /etc/profile
rm -rvf /var/run/*
chmod 777 /mnt/log

modprobe gpio
modprobe fb
modprobe fb_sys_fops
modprobe syscopyarea
modprobe sysfillrect
modprobe sysimgblt
modprobe vfb vfb_enable=1
fbset -fb /dev/fb0 -xres 1920 -yres 1130 -vxres 1920 -vyres 1130 -depth 32

ifconfig lo 127.0.0.1

sysctl -w net.ipv4.tcp_fin_timeout=30
sysctl -w net.ipv4.tcp_tw_reuse=1
sysctl -w net.ipv4.tcp_tw_recycle=0 
sysctl -w net.ipv4.tcp_timestamps=0

# force kernel panic on oom
echo 1 > /proc/sys/vm/panic_on_oom
# set low-memory threshold to 16MB
echo 16384 > /proc/sys/vm/min_free_kbytes

# note: only for v2aa
ifconfig eth0 up
ifconfig eth0 1.8.80.253 netmask 255.255.255.0 broadcast 1.8.80.255
ifconfig eth1 up
ifconfig eth1 1.8.81.253 netmask 255.255.255.0 broadcast 1.8.81.255
#ifconfig eth2 up
#udhcpc -s /etc/udhcpc/default.script -i eth2

# start ntp server
ntpd -l

#udpsvd -vE 0.0.0.0 69 tftpd /mnt/nfs&
#udhcpc -s /etc/udhcpc/default.script

# start sshd
#touch /var/Olympus/DISABLE_SSH
if [ -f /var/Olympus/DISABLE_SSH ]; then
echo "DISABLE SSH"
else
/mnt/others/sbin/sshd -d /etc/sshd/ssh_dss.key -r /etc/sshd/ssh_rsa.key -p 1587
fi


# start nfs server
rpcbind
unfsd -t

if [ -f /var/Olympus/DISABLE_SSH ]; then
sh /mnt/others/sbin/autoroute2.sh
else
sh /mnt/others/sbin/autoroute.sh
#sh /mnt/others/sbin/autoroute_pppoe.sh
fi


# check ezjoin
if [ -e "/var/Olympus/dial.html" ];then
    grep -n 'lync' '/var/Olympus/dial.html'
    if [ $? == 0 ];then
        echo "get lync call type"
    else
        echo "remove dial.html"
        rm /var/Olympus/dial.html
    fi
fi


sh /etc/chkrmt.sh

syslogd -O /mnt/log/m7message -S -s 1024 -b 15 -l 7

cp -rvf /mnt/project/Muse /tmp
cp /mnt/others/sbin/isp /tmp
/mnt/project/Zeus/zeus /mnt/project&
/tmp/isp&

# start audio aec debug program
/mnt/others/sbin/mic_dump &
echo "start iwb"
/mnt/r1_project/Myrtle/Myrtle_iwb.sh &
echo "end start iwb"


