#!/bin/bash
echo ">>>>>starting update..."
# stop service
sudo systemctl stop GrabMachine
sudo systemctl stop front_end_server
sudo systemctl stop SophonGate
sudo systemctl stop SophonFace_SDK
sudo systemctl stop bm_server
sudo systemctl stop fan_monitor
sudo systemctl stop npm
sudo systemctl stop npm_support
sudo systemctl stop npm_support_1
sudo systemctl stop matcher
sudo systemctl stop mongodb
sudo systemctl stop clock
# kernel
sudo dd if=emmcboot.itb of=/dev/mmcblk0p1 bs=16M count=1
# bm_server
echo ">>>>>bm_server upgrade starting..."
rm -rf /system/bin/ /system/lib/ /system/data/ /system/include
if [ $? == 0 ]; then
sync
echo "clear old /system/bin/system/lib /system/data succeed"
else
echo "clear old /system failed"
exit -1
fi
echo "1" > /system/bootup.first
tar xzf install.tgz -C /system/
if [ $? == 0 ]; then
echo "uncompress install.tgz to /system succeed"
echo "bm_server upgrade done will reboot"
echo "sync ..."
sync
echo "will reboot..."
sleep 10
reboot
else
echo "bm_server upgrade failed!!!!!!!"
echo
fi