#!/bin/sh
 if [ ! -f "/sdcard/upd/rb/rtupdateagent" ]; then
 cp /system/bin/ota/rtupdateagent /sdcard/upd/rb/rtupdateagent 
 fi 
 if [ $1 = "test" ]; then
 echo 'Starting recovery delta test.. ' > /sdcard/upd/rb_recovery.log
 /sdcard/upd/rb/rtupdateagent -op=test -delta=/sdcard/upd/rb/recovery_04.18.10CLEA-14-06__05.003.004CLEA-15-06.delta -fspart=rootfs -fspart=system -result=/sdcard/upd/rtupdateresult.txt -verbose=1 -logfile=/sdcard/upd/rb_recovery.log -reboot=0
 else
 echo 'Starting recovery update.. ' > /sdcard/upd/rb_recovery.log
 cp /sdcard/upd/scripts/passwd /etc/passwd >> /sdcard/upd/rb_recovery.log
 rm -r /data/ttndata/ >> /sdcard/upd/rb_recovery.log
 rm -r /data/vendor/TT/ttndata/ >> /sdcard/upd/rb_recovery.log
 rm -r /data/data/com.tomtom.navkit/ttndata/ >> /sdcard/upd/rb_recovery.log
 rm system/vendor/roadtrack/firmware/mcu_* >> /sdcard/upd/rb_recovery.log
 cp /sdcard/upd/mcu/mcu_* system/vendor/roadtrack/firmware/ >> /sdcard/upd/rb_recovery.log
 /sdcard/upd/rb/rtupdateagent -delta=/sdcard/upd/rb/recovery_04.18.10CLEA-14-06__05.003.004CLEA-15-06.delta -fspart=rootfs -fspart=system -result=/sdcard/upd/rtupdateresult.txt -op=update -verbose=1 -logfile=/sdcard/upd/rb_recovery.log -reboot=2
 fi
