#!/bin/sh
#####################################################################
#history
#1. ver 00
#####################################################################
#ERROR CODE 
#  0   success
#  1   failed to unzip file
#  2   file dis-match with the device
#  3   can't found update file
#  4   no version file in update packet
#  5   no version file in device
#####################################################################
source /var/ftp/pub/target/script/var_define
if [ -f $DEVICE_FTP/target.tgz ]; then
	echo "check version information:"

	source $DEVICE_FTP/target/script/parse_version
	################################################################
	# check board type 
	################################################################
	if [ ${DEVICE_TYPE} != ${DEVICE_TYPE_NEW} ]
	then
		echo "upgrade file not for this device! return 2"
		exit 2
	else
		echo "upgrade software. return 0"
		exit 0
	fi
else
		echo "Can not found the upgrade file. return 3"
		exit 3
fi
