#!/bin/sh
URL_INFO="http://qa.frps.lnxall.com:5009/ems_master_x86/ems_gongsheng_master/5.375.1717/ems_ctrl_5.375.0000_x86_64.ipk"
URL_INFO1="http://qa.frps.lnxall.com:5009/ems_master_x86/ems_gongsheng_master/5.375.1717/energy_assign_5.375.0000_x86_64.ipk"
URL_INFO2="http://qa.frps.lnxall.com:5011/hxwang/sshpass_1.06_x86_64.ipk"
URL_INFO3="http://qa.frps.lnxall.com:5011/hxwang/shangweiji/config_import.sh"
URL_INFO4="http://qa.frps.lnxall.com:5011/hxwang/shangweiji/config_export.sh"
wget $URL_INFO -P /tmp/.
wget $URL_INFO1 -P /tmp/.
wget $URL_INFO2 -P /tmp/.
opkg install --force-reinstall /tmp/ems_ctrl_5.375.0000_x86_64.ipk
opkg install --force-reinstall /tmp/energy_assign_5.375.0000_x86_64.ipk
opkg install --force-reinstall /tmp/sshpass_1.06_x86_64.ipk
opkg install /tmp/ems_ctrl_5.375.0000_x86_64.ipk
opkg install /tmp/energy_assign_5.375.0000_x86_64.ipk
opkg install /tmp/sshpass_1.06_x86_64.ipk
sleep 5

echo "replace config_import.sh"
if [ -f /lib/dyiot/bin/config_import.sh ];then 
	mv /lib/dyiot/bin/config_import.sh /lib/dyiot/bin/config_import.sh_bak
fi 

wget $URL_INFO3 -P /lib/dyiot/bin
chmod +x /lib/dyiot/bin/config_import.sh

if [ -f /lib/dyiot/bin/config_import.sh ];then 
	rm /lib/dyiot/bin/config_import.sh_bak 
fi 

echo "replace config_export.sh"
if [ -f /lib/dyiot/bin/config_export.sh ];then 
	mv /lib/dyiot/bin/config_export.sh /lib/dyiot/bin/config_export.sh_bak
fi 

wget $URL_INFO4 -P /lib/dyiot/bin
chmod +x /lib/dyiot/bin/config_export.sh
if [ -f /lib/dyiot/bin/config_export.sh ];then 
	rm /lib/dyiot/bin/config_export.sh_bak 
fi 

echo "success"
