Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh -e
- cd /home/root
- insmod /home/root/8189es.ko
- #insmod /home/root/8723bs.ko
- echo 30000 > /proc/sys/vm/min_free_kbytes
- echo 2 >/proc/sys/kernel/printk
- echo -e "\033[9;0]" > /dev/tty0
- echo 0 > /sys/bus/platform/drivers/imx_busfreq/soc\:busfreq/enable
- if [ -f "/home/root/fac/need_retry_upgrade_firmware.tag" ];then
- if [ -f "/home/root/fac/temp_gateway.bin" ];then
- cp /home/root/fac/lumi_gateway.bin /tmp/hk_update.bin && cd /tmp && tar jxvf hk_update.bin
- cd /tmp/lumi_hub.update && ./update.sh
- fi
- fi
- #/home/root/set_mac.sh &
- if [ -f "/home/root/test_ota.sh" ];then
- ret=`/home/root/test_ota.sh`
- fi
- if [ -f "/lumi/conf/factory_add_scene" ];then
- rm /lumi/conf/factory_add_scene
- fi
- if [ -f "/home/root/daemon.exe" ];then
- cp /home/root/daemon.exe /home/root/daemon
- chmod +x /home/root/daemon
- root@imx6ull14x14evk:~# cat /etc/rc.local
- #!/bin/sh -e
- cd /home/root
- insmod /home/root/8189es.ko
- #insmod /home/root/8723bs.ko
- echo 30000 > /proc/sys/vm/min_free_kbytes
- echo 2 >/proc/sys/kernel/printk
- echo -e "\033[9;0]" > /dev/tty0
- echo 0 > /sys/bus/platform/drivers/imx_busfreq/soc\:busfreq/enable
- if [ -f "/home/root/fac/need_retry_upgrade_firmware.tag" ];then
- if [ -f "/home/root/fac/temp_gateway.bin" ];then
- cp /home/root/fac/lumi_gateway.bin /tmp/hk_update.bin && cd /tmp && tar jxvf hk_update.bin
- cd /tmp/lumi_hub.update && ./update.sh
- fi
- fi
- #/home/root/set_mac.sh &
- if [ -f "/home/root/test_ota.sh" ];then
- ret=`/home/root/test_ota.sh`
- fi
- if [ -f "/lumi/conf/factory_add_scene" ];then
- rm /lumi/conf/factory_add_scene
- fi
- if [ -f "/home/root/daemon.exe" ];then
- cp /home/root/daemon.exe /home/root/daemon
- chmod +x /home/root/daemon
- fi
- #update zigbee
- #if [ -f "/etc/os-release" ] && [ `grep ^MCU_FW_VERSION= /etc/os-release` == "MCU_FW_VERSION=0222" ];then
- # echo "the same ncp version not upgrade"
- # rm /home/root/fac/need_update_coordinator.tag
- #fi
- if [ -f "/home/root/fac/need_update_coordinator.tag" ] && [ `cat /home/root/fac/need_update_coordinator.tag` -gt 1 ];then
- echo "start update zigbee coordinator"
- sleep 8
- if [ ! -f /home/root/hkbridge/stationmode ];then
- /home/root/hkbridge/control_light.sh yellow&
- else
- /home/root/hkbridge/control_light.sh blue&
- fi
- try_times=`cat /home/root/fac/need_update_coordinator.tag`
- let try_times-=1
- echo "retry $try_times"
- echo $try_times > /home/root/fac/need_update_coordinator.tag
- sync
- echo "waiting ..."
- /home/root/fac/test_ota /home/root/fac/Zigbee_V2.27_20200324_1846_PA_Comp_CRC.bin > /tmp/update_coordinator.log
- if [ -f "/tmp/update_coordinator.log" ] && [ "`cat /tmp/update_coordinator.log | grep "Success"`" != "" ];then
- echo "update zigbee coordinator ok"
- rm /home/root/fac/need_update_coordinator.tag
- else
- echo "reboot"
- reboot
- fi
- echo 0 > /sys/class/backlight/lumi_r/brightness
- echo 0 > /sys/class/backlight/lumi_g/brightness
- echo 0 > /sys/class/backlight/lumi_b/brightness
- killall control_light.sh
- fi
- /home/root/key_rgb > /dev/null 2>&1 &
- /lumi/app/miio/start_ot.sh > /dev/null 2>&1 &
- echo "=========================================="
- echo "======== ^_^ start miot hkbridge ========="
- echo "=========================================="
- #check guard file, agin install if breakdown
- if [ `ls -l /home/root/launch.sh | awk '{print $5}'` -lt 100 -o `ls -l /home/root/launch.sh | awk '{print $5}'` -lt 100 ]; then
- # record numbler of the update fial
- if [ ! -f "/home/root/fac/updateInstall" ];then
- echo "1" > /home/root/fac/updateInstall
- sync
- fi
- if [ -f "/home/root/fac/temp_gateway.bin" ] && [ `md5sum /home/root/fac/temp_gateway.bin | awk '{print $1}'` == `cat /home/root/fac/temp_gateway_md5` ] && [ `cat /home/root/fac/updateInstall` -lt 2 ];then
- i=`cat /home/root/fac/updateInstall`
- echo "$((i + 1))" > /home/root/fac/updateInstall
- sync
- cp /home/root/fac/temp_gateway.bin /tmp/hk_update.bin && cd /tmp && tar jxvf hk_update.bin
- cd /tmp/lumi_hub.update && ./update.sh
- else
- cp /home/root/fac/lumi_gateway.bin /tmp/hk_update.bin && cd /tmp && tar jxvf hk_update.bin
- cd /tmp/lumi_hub.update && ./update.sh
- fi
- fi
- if [ -f "/home/root/fac/updateInstall" ];then
- rm /home/root/fac/updateInstall
- fi
- cd /home/root && /home/root/launch.sh >/dev/null 2>&1 &
- cd /home/root && /home/root/launch_monitor.sh >/dev/null 2>&1 &
- /etc/init.d/dropbear start &
- /home/root/fac/fac_test
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement