#!/bin/sh
if [ ! $1 ]; then
host=192.168.1.11
else
host=$1
fi
echo "host is $host"

echo "update shell files"
cd /etc/init.d
tftp -g -r rcS $host
chmod +x rcS
tftp -g -r S71ntpdate $host
chmod +x S71ntpdate 
tftp -g -r S81srvrd $host
chmod +x S81srvrd 
tftp -g -r S90app $host
chmod +x S90app 

echo "update usr app"
cd /usr_app
killall app
tftp -g -r app $host
chmod +x app
tftp -g -r ysp_cfg.ini $host
tftp -g -r syscfg.ini $host
echo "update iec file"
cd /scl_srvr
tftp -g -r scl_srvr.tar.gz $host
tar -xvf scl_srvr.tar.gz
echo "update html file"
cd /var/www/web
tftp -g -r web.tar.gz $host
tar -xvf web.tar.gz 

cd /
tftp -g -r mk_ied.sh $host
chmod +x mk_ied.sh
 
echo "update all files ok"
echo "now reboot system"
#reboot
