#!/system/bin/sh

count=1
success=1

check_cp_files()
{	
	count=1
	if test -f /system/etc/delfilelist
		then
			while read line || [[ -n ${line} ]]
			do
			if test -f $line
				then
				echo "$line is OK."
			else
				if test -d $line
				then
				echo "$line is OK."
				else
				echo "failed by $line."
				success = 0
				fi
			fi
				count=`busybox expr $count + 1`	
			done < /system/etc/delfilelist
		fi
}

check_result()
{
	if test $success -ne 1
	then
		echo "-----------> copy files FAILED, reboot..."
		busybox reboot
	else
		echo "-----------> copy all files successfully..."
	fi
}

echo "check_cp_files..."
check_cp_files
busybox sync
check_result
busybox sync
busybox sync

